Fixing a bug in shim and keeping reset_ssh before the exit_if_enabled() to minimize the changes
This commit is contained in:
Родитель
21d9b79a5b
Коммит
b82e3139f6
|
@ -39,7 +39,7 @@ function find_python(){
|
|||
eval ${python_exec_command}="python"
|
||||
else
|
||||
# Python was not found. Searching for Python3 now.
|
||||
if command -v python >/dev/null 2>&1 ; then
|
||||
if command -v python3 >/dev/null 2>&1 ; then
|
||||
eval ${python_exec_command}="python3"
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -69,6 +69,8 @@ def enable():
|
|||
hutil = Util.HandlerUtility(waagent.Log, waagent.Error)
|
||||
hutil.do_parse_context('Enable')
|
||||
try:
|
||||
hutil.exit_if_enabled(remove_protected_settings=True) # If no new seqNum received, exit.
|
||||
|
||||
reset_ssh = None
|
||||
remove_user = None
|
||||
protect_settings = hutil.get_protected_settings()
|
||||
|
@ -83,19 +85,14 @@ def enable():
|
|||
message="(03002)Argument error, conflicting operations")
|
||||
raise Exception("Cannot reset sshd_config and remove a user in one operation.")
|
||||
|
||||
hutil.exit_if_enabled()
|
||||
|
||||
_forcibly_reset_chap(hutil)
|
||||
|
||||
# check port each time the VM boots up
|
||||
if reset_ssh:
|
||||
_open_ssh_port()
|
||||
hutil.log("Succeeded in check and open ssh port.")
|
||||
|
||||
if _is_sshd_config_modified(protect_settings):
|
||||
_backup_sshd_config(SshdConfigPath)
|
||||
|
||||
if reset_ssh:
|
||||
_open_ssh_port()
|
||||
hutil.log("Succeeded in check and open ssh port.")
|
||||
waagent.AddExtensionEvent(name=hutil.get_name(), op="scenario", isSuccess=True, message="reset-ssh")
|
||||
_reset_sshd_config(SshdConfigPath)
|
||||
hutil.log("Succeeded in reset sshd_config.")
|
||||
|
|
Загрузка…
Ссылка в новой задаче