Skip to content
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
11 changes: 6 additions & 5 deletions VMAccess/HandlerManifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
{
"version": 1.0,
"handlerManifest": {
"disableCommand": "extension_shim.sh -c ./vmaccess.py -d",
"disableCommand": "extension_noop.sh",
"enableCommand": "extension_shim.sh -c ./vmaccess.py -e",
"installCommand": "extension_shim.sh -c ./vmaccess.py -i",
"uninstallCommand": "extension_shim.sh -c ./vmaccess.py -u",
"updateCommand": "extension_shim.sh -c ./vmaccess.py -p",
"installCommand": "extension_noop.sh",
"uninstallCommand": "extension_noop.sh",
"updateCommand": "extension_noop.sh",
"rebootAfterInstall": false,
"reportHeartbeat": false
"reportHeartbeat": false,
"continueOnUpdateFailure": true
}
}
]
4 changes: 4 additions & 0 deletions VMAccess/extension_noop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash

# There is no need to write a status file for commands other than Enable
exit 0
34 changes: 1 addition & 33 deletions VMAccess/vmaccess.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,27 +111,13 @@ def main():

try:
for a in sys.argv[1:]:
if re.match("^([-/]*)(disable)", a):
disable()
elif re.match("^([-/]*)(uninstall)", a):
uninstall()
elif re.match("^([-/]*)(install)", a):
install()
elif re.match("^([-/]*)(enable)", a):
if re.match("^([-/]*)(enable)", a):
enable()
elif re.match("^([-/]*)(update)", a):
update()
except Exception as e:
err_msg = "Failed with error: {0}, {1}".format(e, traceback.format_exc())
logger.error(err_msg)


def install():
hutil = handler_util.HandlerUtility()
hutil.do_parse_context('Install')
hutil.do_exit(0, 'Install', 'success', '0', 'Install Succeeded')


def enable():
hutil = handler_util.HandlerUtility()
hutil.do_parse_context('Enable')
Expand Down Expand Up @@ -191,24 +177,6 @@ def _is_sshd_config_modified(protected_settings):
return result is not None


def uninstall():
hutil = handler_util.HandlerUtility()
hutil.do_parse_context('Uninstall')
hutil.do_exit(0, 'Uninstall', 'success', '0', 'Uninstall succeeded')


def disable():
hutil = handler_util.HandlerUtility()
hutil.do_parse_context('Disable')
hutil.do_exit(0, 'Disable', 'success', '0', 'Disable Succeeded')


def update():
hutil = handler_util.HandlerUtility()
hutil.do_parse_context('Update')
hutil.do_exit(0, 'Update', 'success', '0', 'Update Succeeded')


def _remove_user_account(user_name, hutil):
hutil.log("Removing user account")

Expand Down