mirror of
https://github.com/linux-system-roles/network.git
synced 2026-07-19 01:17:00 +00:00
library: move main code to explicit main() function
Without it, we unintentionally declared 3 global variables (connections, cmd, run_env_ansible). This was not intended, and results in possibly wrong behavior by accidentally using the global variables.
This commit is contained in:
parent
63314aeb92
commit
cf8522e5cc
1 changed files with 4 additions and 1 deletions
|
|
@ -2819,7 +2819,7 @@ class Cmd_initscripts(Cmd):
|
|||
|
||||
###############################################################################
|
||||
|
||||
if __name__ == '__main__':
|
||||
def main():
|
||||
connections = None
|
||||
cmd = None
|
||||
run_env_ansible = RunEnvironmentAnsible()
|
||||
|
|
@ -2841,3 +2841,6 @@ if __name__ == '__main__':
|
|||
warn_traceback = not isinstance(e, MyError))
|
||||
run_env_ansible.exit_json(connections,
|
||||
changed = (cmd is not None and cmd.is_changed_modified_system))
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue