Fixing a bug in shim and keeping reset_ssh before the exit_if_enabled() to minimize the changes

This commit is contained in:
Varad Meru 2019-01-25 14:25:07 -08:00
Родитель 21d9b79a5b
Коммит b82e3139f6
2 изменённых файлов: 5 добавлений и 8 удалений

Просмотреть файл

@ -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.")