Skip to content
This repository was archived by the owner on Sep 12, 2024. It is now read-only.
Merged
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
4 changes: 2 additions & 2 deletions LCM/scripts/GetDscConfiguration.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
dsc_host_lock_path = join(dsc_host_base_path, 'dsc_host_lock')
dsc_host_switch_path = join(dsc_host_base_path, 'dsc_host_ready')

LG().Log("DEBUG", "Starting script logic for " + argv[0]+ " runing with python " + str(sys.version_info.major))
LG().Log("DEBUG", "Starting script logic for " + argv[0]+ " runing with python " + str(sys.version_info))

if ("omsconfig" in helperlib.DSC_SCRIPT_PATH):
write_omsconfig_host_switch_event(pathToCurrentScript, isfile(dsc_host_switch_path))
Expand Down Expand Up @@ -100,5 +100,5 @@
print(stdout)
print(stderr)

LG().Log("DEBUG", "End of script logic for " + argv[0] + " runing with python " + str(sys.version_info.major))
LG().Log("DEBUG", "End of script logic for " + argv[0] + " runing with python " + str(sys.version_info))

4 changes: 2 additions & 2 deletions LCM/scripts/GetDscLocalConfigurationManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
dsc_host_lock_path = join(dsc_host_base_path, 'dsc_host_lock')
dsc_host_switch_path = join(dsc_host_base_path, 'dsc_host_ready')

LG().Log("DEBUG", "Starting script logic for " + argv[0]+ " runing with python " + str(sys.version_info.major))
LG().Log("DEBUG", "Starting script logic for " + argv[0]+ " runing with python " + str(sys.version_info))

if ("omsconfig" in helperlib.DSC_SCRIPT_PATH):
write_omsconfig_host_switch_event(pathToCurrentScript, isfile(dsc_host_switch_path))
Expand Down Expand Up @@ -99,5 +99,5 @@
print(stdout)
print(stderr)

LG().Log("DEBUG", "End of script logic for " + argv[0] + " runing with python " + str(sys.version_info.major))
LG().Log("DEBUG", "End of script logic for " + argv[0] + " runing with python " + str(sys.version_info))

4 changes: 2 additions & 2 deletions LCM/scripts/PerformRequiredConfigurationChecks.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,6 @@ def run_perform_required_configuration_checks():
print(stdout)

if __name__ == "__main__":
LG().Log("DEBUG", "Starting Main method for " + argv[0] + " runing with python " + str(sys.version_info.major))
LG().Log("DEBUG", "Starting Main method for " + argv[0] + " runing with python " + str(sys.version_info))
main()
LG().Log("DEBUG", "End of Main method for " + argv[0] + " runing with python " + str(sys.version_info.major))
LG().Log("DEBUG", "End of Main method for " + argv[0] + " runing with python " + str(sys.version_info))
4 changes: 2 additions & 2 deletions LCM/scripts/Register.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def usage():
nxDSCLog = load_source('nxDSCLog', DSCLogPath)
LG = nxDSCLog.DSCLog

LG().Log("DEBUG", "Starting script logic for " + argv[0]+ " runing with python " + str(sys.version_info.major))
LG().Log("DEBUG", "Starting script logic for " + argv[0]+ " runing with python " + str(sys.version_info))

# Apply a DSC meta configuration based on a template
Variables = dict()
Expand Down Expand Up @@ -231,4 +231,4 @@ def usage():

shutil.rmtree(tempdir)

LG().Log("DEBUG", "End of script logic for " + argv[0] + " runing with python " + str(sys.version_info.major))
LG().Log("DEBUG", "End of script logic for " + argv[0] + " runing with python " + str(sys.version_info))
4 changes: 2 additions & 2 deletions LCM/scripts/RemoveModule.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,6 @@ def main(args):
shutil.rmtree(modulePath)

if __name__ == "__main__":
LG().Log("DEBUG", "Starting Main method for " + argv[0] + " runing with python " + str(sys.version_info.major))
LG().Log("DEBUG", "Starting Main method for " + argv[0] + " runing with python " + str(sys.version_info))
main(sys.argv[1:])
LG().Log("DEBUG", "End of Main method for " + argv[0] + " runing with python " + str(sys.version_info.major))
LG().Log("DEBUG", "End of Main method for " + argv[0] + " runing with python " + str(sys.version_info))
4 changes: 2 additions & 2 deletions LCM/scripts/RestoreConfiguration.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
dsc_host_lock_path = join(dsc_host_base_path, 'dsc_host_lock')
dsc_host_switch_path = join(dsc_host_base_path, 'dsc_host_ready')

LG().Log("DEBUG", "Starting script logic for " + argv[0]+ " runing with python " + str(sys.version_info.major))
LG().Log("DEBUG", "Starting script logic for " + argv[0]+ " runing with python " + str(sys.version_info))

if ("omsconfig" in helperlib.DSC_SCRIPT_PATH):
write_omsconfig_host_switch_event(pathToCurrentScript, isfile(dsc_host_switch_path))
Expand Down Expand Up @@ -94,4 +94,4 @@
print(stdout)
print(stderr)

LG().Log("DEBUG", "End of script logic for " + argv[0] + " runing with python " + str(sys.version_info.major))
LG().Log("DEBUG", "End of script logic for " + argv[0] + " runing with python " + str(sys.version_info))
4 changes: 2 additions & 2 deletions LCM/scripts/SetDscLocalConfigurationManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,6 @@ def signal_handler(signalNumber, frame):
if __name__ == "__main__":
# register the SIGTERM handler
signal.signal(signal.SIGTERM, signal_handler)
LG().Log("DEBUG", "Starting Main method for " + argv[0] + " runing with python " + str(sys.version_info.major))
LG().Log("DEBUG", "Starting Main method for " + argv[0] + " runing with python " + str(sys.version_info))
main(argv)
LG().Log("DEBUG", "End of Main method for " + argv[0] + " runing with python " + str(sys.version_info.major))
LG().Log("DEBUG", "End of Main method for " + argv[0] + " runing with python " + str(sys.version_info))
4 changes: 2 additions & 2 deletions LCM/scripts/StartDscConfiguration.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,6 @@ def main(argv):
print(stdout)
print(stderr)

LG().Log("DEBUG", "Starting Main method for " + argv[0] + " runing with python " + str(sys.version_info.major))
LG().Log("DEBUG", "Starting Main method for " + argv[0] + " runing with python " + str(sys.version_info))
main(argv[1:])
LG().Log("DEBUG", "End of Main method for " + argv[0] + " runing with python " + str(sys.version_info.major))
LG().Log("DEBUG", "End of Main method for " + argv[0] + " runing with python " + str(sys.version_info))
4 changes: 2 additions & 2 deletions LCM/scripts/TestDscConfiguration.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
dsc_host_lock_path = join(dsc_host_base_path, 'dsc_host_lock')
dsc_host_switch_path = join(dsc_host_base_path, 'dsc_host_ready')

LG().Log("DEBUG", "Starting script logic for " + argv[0]+ " runing with python " + str(sys.version_info.major))
LG().Log("DEBUG", "Starting script logic for " + argv[0]+ " runing with python " + str(sys.version_info))

if ("omsconfig" in helperlib.DSC_SCRIPT_PATH):
write_omsconfig_host_switch_event(pathToCurrentScript, isfile(dsc_host_switch_path))
Expand Down Expand Up @@ -102,4 +102,4 @@
print(stdout)
print(stderr)

LG().Log("DEBUG", "End of script logic for " + argv[0] + " runing with python " + str(sys.version_info.major))
LG().Log("DEBUG", "End of script logic for " + argv[0] + " runing with python " + str(sys.version_info))
4 changes: 2 additions & 2 deletions LCM/scripts/python3/GetDscConfiguration.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
dsc_host_lock_path = join(dsc_host_base_path, 'dsc_host_lock')
dsc_host_switch_path = join(dsc_host_base_path, 'dsc_host_ready')

LG().Log("DEBUG", "Starting script logic for " + argv[0]+ " runing with python " + str(sys.version_info.major))
LG().Log("DEBUG", "Starting script logic for " + argv[0]+ " runing with python " + str(sys.version_info))

if ("omsconfig" in helperlib.DSC_SCRIPT_PATH):
write_omsconfig_host_switch_event(pathToCurrentScript, isfile(dsc_host_switch_path))
Expand Down Expand Up @@ -106,4 +106,4 @@
print(stdout)
print(stderr)

LG().Log("DEBUG", "End of script logic for " + argv[0] + " runing with python " + str(sys.version_info.major))
LG().Log("DEBUG", "End of script logic for " + argv[0] + " runing with python " + str(sys.version_info))
4 changes: 2 additions & 2 deletions LCM/scripts/python3/GetDscLocalConfigurationManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
dsc_host_lock_path = join(dsc_host_base_path, 'dsc_host_lock')
dsc_host_switch_path = join(dsc_host_base_path, 'dsc_host_ready')

LG().Log("DEBUG", "Starting script logic for " + argv[0]+ " runing with python " + str(sys.version_info.major))
LG().Log("DEBUG", "Starting script logic for " + argv[0]+ " runing with python " + str(sys.version_info))

if ("omsconfig" in helperlib.DSC_SCRIPT_PATH):
write_omsconfig_host_switch_event(pathToCurrentScript, isfile(dsc_host_switch_path))
Expand Down Expand Up @@ -105,4 +105,4 @@
print(stdout)
print(stderr)

LG().Log("DEBUG", "End of script logic for " + argv[0] + " runing with python " + str(sys.version_info.major))
LG().Log("DEBUG", "End of script logic for " + argv[0] + " runing with python " + str(sys.version_info))
4 changes: 2 additions & 2 deletions LCM/scripts/python3/PerformRequiredConfigurationChecks.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,6 @@ def run_perform_required_configuration_checks():
print(stdout)

if __name__ == "__main__":
LG().Log("DEBUG", "Starting Main method for " + argv[0] + " runing with python " + str(sys.version_info.major))
LG().Log("DEBUG", "Starting Main method for " + argv[0] + " runing with python " + str(sys.version_info))
main()
LG().Log("DEBUG", "End of Main method for " + argv[0] + " runing with python " + str(sys.version_info.major))
LG().Log("DEBUG", "End of Main method for " + argv[0] + " runing with python " + str(sys.version_info))
4 changes: 2 additions & 2 deletions LCM/scripts/python3/Register.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def usage():
--Help
""")

LG().Log("DEBUG", "Starting script logic for " + argv[0]+ " runing with python " + str(sys.version_info.major))
LG().Log("DEBUG", "Starting script logic for " + argv[0]+ " runing with python " + str(sys.version_info))

# Apply a DSC meta configuration based on a template
Variables = dict()
Expand Down Expand Up @@ -233,4 +233,4 @@ def usage():
os.system("<DSC_SCRIPT_PATH>/python3/SetDscLocalConfigurationManager.py -configurationmof " + meta_path)

shutil.rmtree(tempdir)
LG().Log("DEBUG", "End of script logic for " + argv[0] + " runing with python " + str(sys.version_info.major))
LG().Log("DEBUG", "End of script logic for " + argv[0] + " runing with python " + str(sys.version_info))
4 changes: 2 additions & 2 deletions LCM/scripts/python3/RemoveModule.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def main(args):
shutil.rmtree(modulePath)

if __name__ == "__main__":
LG().Log("DEBUG", "Starting Main method for " + argv[0] + " runing with python " + str(sys.version_info.major))
LG().Log("DEBUG", "Starting Main method for " + argv[0] + " runing with python " + str(sys.version_info))
main(sys.argv[1:])
LG().Log("DEBUG", "End of Main method for " + argv[0] + " runing with python " + str(sys.version_info.major))
LG().Log("DEBUG", "End of Main method for " + argv[0] + " runing with python " + str(sys.version_info))

4 changes: 2 additions & 2 deletions LCM/scripts/python3/RestoreConfiguration.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
dsc_host_lock_path = join(dsc_host_base_path, 'dsc_host_lock')
dsc_host_switch_path = join(dsc_host_base_path, 'dsc_host_ready')

LG().Log("DEBUG", "Starting script logic for " + argv[0]+ " runing with python " + str(sys.version_info.major))
LG().Log("DEBUG", "Starting script logic for " + argv[0]+ " runing with python " + str(sys.version_info))

if ("omsconfig" in helperlib.DSC_SCRIPT_PATH):
write_omsconfig_host_switch_event(pathToCurrentScript, isfile(dsc_host_switch_path))
Expand Down Expand Up @@ -98,4 +98,4 @@
print(stdout)
print(stderr)

LG().Log("DEBUG", "End of script logic for " + argv[0] + " runing with python " + str(sys.version_info.major))
LG().Log("DEBUG", "End of script logic for " + argv[0] + " runing with python " + str(sys.version_info))
4 changes: 2 additions & 2 deletions LCM/scripts/python3/SetDscLocalConfigurationManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,6 @@ def apply_meta_config(args):
fileHandle.close()

if __name__ == "__main__":
LG().Log("DEBUG", "Starting Main method for " + argv[0] + " runing with python " + str(sys.version_info.major))
LG().Log("DEBUG", "Starting Main method for " + argv[0] + " runing with python " + str(sys.version_info))
main(argv)
LG().Log("DEBUG", "End of Main method for " + argv[0] + " runing with python " + str(sys.version_info.major))
LG().Log("DEBUG", "End of Main method for " + argv[0] + " runing with python " + str(sys.version_info))
4 changes: 2 additions & 2 deletions LCM/scripts/python3/StartDscConfiguration.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,6 @@ def main(argv):
print(stdout)
print(stderr)

LG().Log("DEBUG", "Starting Main method for " + argv[0] + " runing with python " + str(sys.version_info.major))
LG().Log("DEBUG", "Starting Main method for " + argv[0] + " runing with python " + str(sys.version_info))
main(argv[1:])
LG().Log("DEBUG", "End of Main method for " + argv[0] + " runing with python " + str(sys.version_info.major))
LG().Log("DEBUG", "End of Main method for " + argv[0] + " runing with python " + str(sys.version_info))
4 changes: 2 additions & 2 deletions LCM/scripts/python3/TestDscConfiguration.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
dsc_host_lock_path = join(dsc_host_base_path, 'dsc_host_lock')
dsc_host_switch_path = join(dsc_host_base_path, 'dsc_host_ready')

LG().Log("DEBUG", "Starting script logic for " + argv[0]+ " runing with python " + str(sys.version_info.major))
LG().Log("DEBUG", "Starting script logic for " + argv[0]+ " runing with python " + str(sys.version_info))

if ("omsconfig" in helperlib.DSC_SCRIPT_PATH):
write_omsconfig_host_switch_event(pathToCurrentScript, isfile(dsc_host_switch_path))
Expand Down Expand Up @@ -109,4 +109,4 @@
print(stdout)
print(stderr)

LG().Log("DEBUG", "End of script logic for " + argv[0] + " runing with python " + str(sys.version_info.major))
LG().Log("DEBUG", "End of script logic for " + argv[0] + " runing with python " + str(sys.version_info))
23 changes: 15 additions & 8 deletions Providers/Scripts/3.x/Scripts/nxService.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,8 @@ def GetSystemdState(sc):
(process_stdout, process_stderr, retval) = Process(
[systemctl_path, "status", sc.Name])
if retval is 0:
if '(running)' in process_stdout:
process_stdout_str = process_stdout.decode() if isinstance(process_stdout, bytes) else process_stdout
if '(running)' in process_stdout_str:
return "running"
return "stopped"

Expand Down Expand Up @@ -602,7 +603,8 @@ def GetUpstartState(sc):
" failed: " + process_stderr)
return ""

if (sc.Name + " start") in process_stdout:
process_stdout_str = process_stdout.decode() if isinstance(process_stdout, bytes) else process_stdout
if (sc.Name + " start") in process_stdout_str:
return "running"
else:
return "stopped"
Expand Down Expand Up @@ -678,7 +680,8 @@ def GetUpstartEnabled(sc):
(process_stdout, process_stderr, retval) = Process(
['chkconfig', sc.Name, '']) # try init style
if retval is 0:
if 'off' not in process_stdout:
process_stdout_str = process_stdout.decode() if isinstance(process_stdout, bytes) else process_stdout
if 'off' not in process_stdout_str:
return True
return False
if start_on_exists and start_on_is_enabled:
Expand Down Expand Up @@ -855,7 +858,8 @@ def ServiceExistsInSystemd(sc):
(process_stdout, process_stderr, retval) = Process(
[systemctl_path, "status", sc.Name])
if retval is not 0:
if "Loaded: loaded" in process_stdout:
process_stdout_str = process_stdout.decode() if isinstance(process_stdout, bytes) else process_stdout
if "Loaded: loaded" in process_stdout_str:
return True
else:
return False
Expand Down Expand Up @@ -926,13 +930,14 @@ def ModifySystemdService(sc):
(process_stdout, process_stderr, retval) = Process(
[systemctl_path, "status", sc.Name + '.service'])
# retval may be non zero even if service exists for 'status'.
if 'No such file or directory' in process_stdout:
process_stdout_str = process_stdout.decode() if isinstance(process_stdout, bytes) else process_stdout
if 'No such file or directory' in process_stdout_str:
Print("Error: " + systemctl_path + " status " + sc.Name +
" failed: " + process_stderr, file=sys.stderr)
LG().Log('ERROR', "Error: " + systemctl_path +
" status " + sc.Name + " failed: " + process_stderr)
return [-1]
if 'Active: active' in process_stdout:
if 'Active: active' in process_stdout_str:
Print("Running", file=sys.stderr)
LG().Log('INFO', "Running")
if sc.State and sc.State != "running":
Expand Down Expand Up @@ -1132,7 +1137,8 @@ def ModifyInitService(sc):
LG().Log('ERROR', "Error: " + check_enabled_program +
" -f " + sc.Name + " defaults failed: " + process_stderr)
return [-1]
if 'already exist' in process_stdout: # we need to remove them first
process_stdout_str = process_stdout.decode() if isinstance(process_stdout, bytes) else process_stdout
if 'already exist' in process_stdout_str: # we need to remove them first
(process_stdout, process_stderr, retval) = Process(
[check_enabled_program, "-f", sc.Name, "remove"])
if retval is not 0:
Expand Down Expand Up @@ -1190,7 +1196,8 @@ def ModifyInitService(sc):
LG().Log('ERROR', "Error: " + check_enabled_program +
" -f " + sc.Name + " defaults failed: " + process_stderr)
return [-1]
if 'already exist' in process_stdout: # we need to remove them first
process_stdout_str = process_stdout.decode() if isinstance(process_stdout, bytes) else process_stdout
if 'already exist' in process_stdout_str: # we need to remove them first
(process_stdout, process_stderr, retval) = Process(
[check_enabled_program, "-f", sc.Name, "remove"])
if retval is not 0:
Expand Down