Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove 107 exit code #26

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,8 @@ test-salt-vmtools-linux:
- cat /etc/salt/minion | grep 'master:\ 192.168.0.5' 1>/dev/null
- sudo -u root ps -ef | grep salt
- systemctl is-active salt-minion
- sudo -u root ./svtminion.sh --stop --loglevel debug || { _retn=$?; if [[ ${_retn} -eq 107 ]]; then echo "test correct"; else echo "test failed, salt-minion should be stopped, returned '${_retn}'"; exit 1; fi; }
# VM Tools doesn't support 107 for now... until then we return 100
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably ought to delete this file since no longer on GitLab

- sudo -u root ./svtminion.sh --stop --loglevel debug || { _retn=$?; if [[ ${_retn} -eq 100 ]]; then echo "test correct"; else echo "test failed, salt-minion should be stopped, returned '${_retn}'"; exit 1; fi; }
- sudo -u root ps -ef | grep salt
- systemctl is-active salt-minion || { echo "test correct"; }
- sudo -u root ps -ef | grep salt
Expand Down Expand Up @@ -606,7 +607,8 @@ test-tags-salt-vmtools-linux:
- cat /etc/salt/minion | grep 'master:\ 192.168.0.5' 1>/dev/null
- sudo -u root ps -ef | grep salt
- sudo -u root systemctl is-active salt-minion
- sudo -u root ./svtminion.sh --stop --loglevel debug || { _retn=$?; if [[ ${_retn} -eq 107 ]]; then echo "test correct"; else echo "test failed, salt-minion should be stopped, returned '${_retn}'"; exit 1; fi; }
# VM Tools doesn't support 107 for now... until then we return 100
- sudo -u root ./svtminion.sh --stop --loglevel debug || { _retn=$?; if [[ ${_retn} -eq 100 ]]; then echo "test correct"; else echo "test failed, salt-minion should be stopped, returned '${_retn}'"; exit 1; fi; }
- sudo -u root ps -ef | grep salt
- systemctl is-active salt-minion || { echo "test correct"; }
- sudo -u root ps -ef | grep salt
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ or `Get-Help svtminion.ps1`:
- 104 - Removing
- 105 - Removal failed
- 106 - External installation detected
- 107 - Installed but stopped
- 107 - Installed but stopped (future support, returns 100 for now)

NOTE: This script must be executed with Administrator privileges.

Expand Down Expand Up @@ -440,7 +440,7 @@ or `Get-Help svtminion.ps1`:
104 - Removing
105 - Removal failed
106 - External installation detected
107 - Installed but stopped
107 - Installed but stopped (future support, returns 100 for now)

Exits with the `scriptFailed` exit code (126) under the following
conditions:
Expand Down
11 changes: 6 additions & 5 deletions linux/svtminion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ declare -a m_cfg_values
# 100 + 4 => removing
# 100 + 5 => removeFailed
# 100 + 6 => externalInstall
# 100 + 7 => installedStopped
# 100 + 7 => installedStopped (future support, returns 100 for now)
# 126 => scriptFailed
# 130 => scriptTerminated
declare -A STATUS_CODES_ARY
Expand All @@ -159,7 +159,8 @@ STATUS_CODES_ARY[installFailed]=103
STATUS_CODES_ARY[removing]=104
STATUS_CODES_ARY[removeFailed]=105
STATUS_CODES_ARY[externalInstall]=106
STATUS_CODES_ARY[installedStopped]=107
# VM Tools doesn't support 107. For now we return 100
STATUS_CODES_ARY[installedStopped]=100
STATUS_CODES_ARY[scriptFailed]=126
STATUS_CODES_ARY[scriptTerminated]=130

Expand Down Expand Up @@ -1328,7 +1329,7 @@ _create_pre_3006_helper_scripts() {
# 4 => removing
# 5 => removeFailed
# 6 => externalInstall
# 7 => installedStopped
# 7 => installedStopped (future support, returns 100 for now)
# 126 => scriptFailed
#
# Side Effects:
Expand Down Expand Up @@ -1410,7 +1411,7 @@ _status_fn() {
# 4 => removing
# 5 => removeFailed
# 6 => externalInstall
# 7 => installedStopped
# 7 => installedStopped (future support, returns 100 for now)
# 126 => scriptFailed
#
# Side Effects:
Expand Down Expand Up @@ -1500,7 +1501,7 @@ _stop_fn() {
# 4 => removing
# 5 => removeFailed
# 6 => externalInstall
# 7 => installedStopped
# 7 => installedStopped (future support, returns 100 for now)
# 126 => scriptFailed
#
# Side Effects:
Expand Down
2 changes: 1 addition & 1 deletion releases/1.7/svtminion.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ $STATUS_CODES = @{
"removing" = 104;
"removeFailed" = 105;
"externalInstall" = 106;
"installedStopped" = 107;
"installedStopped" = 100;
"scriptFailed" = 126;
"scriptTerminated" = 130;
100 = "installed";
Expand Down
3 changes: 2 additions & 1 deletion tests/linux/test-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ cat /etc/salt/minion
cat /etc/salt/minion | grep 'master:\ 192.168.0.5' 1>/dev/null
ps -ef | grep salt
systemctl is-active salt-minion
./svtminion.sh --stop --loglevel debug || { _retn=$?; if [[ ${_retn} -eq 107 ]]; then echo "test correct"; else echo "test failed, salt-minion should be stopped, returned '${_retn}'"; exit 1; fi; }
## VM Tools doesn't support 107 for now... until then we return 100
./svtminion.sh --stop --loglevel debug || { _retn=$?; if [[ ${_retn} -eq 100 ]]; then echo "test correct"; else echo "test failed, salt-minion should be stopped, returned '${_retn}'"; exit 1; fi; }
ps -ef | grep salt
systemctl is-active salt-minion || { echo "test correct"; }
ps -ef | grep salt
Expand Down
4 changes: 3 additions & 1 deletion tests/windows/functional/test_status.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ function test_Get-Status_installedStopped {
-Value $reg_value
function Get-ServiceStatus { return "Stopped" }
$result = Get-Status
if ($result -eq $STATUS_CODES["installedStopped"]) { return 0 }
# We'll set this back once VM Tools adds support for this code
#if ($result -eq $STATUS_CODES["installedStopped"]) { return 0 }
if ($result -eq $STATUS_CODES["installed"]) { return 0 }
return 1
}

Expand Down
10 changes: 6 additions & 4 deletions windows/svtminion.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ installation status as follows:
- 104 - Removing
- 105 - Removal failed
- 106 - External installation detected
- 107 - Installed but stopped
- 107 - Installed but stopped (future support, returns 100 for now)

NOTE: This script must be executed with Administrator privileges.

Expand Down Expand Up @@ -199,7 +199,7 @@ param(
# 104 - Removing
# 105 - Removal failed
# 106 - External installation detected
# 107 - Installed but stopped
# 107 - Installed but stopped (future support, returns 100 for now)
#
# Exits with the `scriptFailed` exit code (126) under the following
# conditions:
Expand Down Expand Up @@ -287,7 +287,7 @@ if ($help) {
}

# This value is populated via CICD during build
$SCRIPT_VERSION = "2024.12.05"
$SCRIPT_VERSION = "SCRIPT_VERSION_REPLACE"
if ($Version) {
Write-Host $SCRIPT_VERSION
exit 0
Expand All @@ -309,7 +309,9 @@ $STATUS_CODES = @{
"removing" = 104;
"removeFailed" = 105;
"externalInstall" = 106;
"installedStopped" = 107;
# VM Tools currently doesn't support 107. We'll add this back
# once they do. So, until then, we just return 100
"installedStopped" = 100;
"scriptFailed" = 126;
"scriptTerminated" = 130;
100 = "installed";
Expand Down
Loading