Changeset 40895
- Timestamp:
- Sep 24, 2019, 11:12:13 AM (7 years ago)
- Location:
- branches/ipp-132_automate_jira_conf_backups/utils/python
- Files:
-
- 2 added
- 1 edited
-
generic_utils.py (added)
-
generic_utils_test.py (added)
-
subprocess_utils.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/ipp-132_automate_jira_conf_backups/utils/python/subprocess_utils.py
r40885 r40895 2 2 3 3 # Plans are to flesh this out a bit more to make some smarter copying etc 4 5 6 class SubprocessError(Exception): 7 """Errors in Popen stderr subprocess""" 8 9 10 def _args_check(args, function_name): 11 if args is None: 12 print("Error: no arguments provided in ", function_name) 13 return 2 14 if type(args) != list or len(args) == 0: 15 print("Error: at least 1 arg must be given for ", function_name) 16 return 2 17 return 0 4 18 5 19 … … 18 32 19 33 34 def chmod_wrapper(args: [str]): 35 if args is None: 36 return 2 37 command_and_args = ["chmod"] + args 38 return simple_unix_wrapper(command_and_args) 39 40 20 41 def simple_unix_wrapper(command_and_args: [str]): 21 if command_and_args is None: 22 print("error: unix wrapper needs some arguments") 23 return 2 24 if type(command_and_args) != list or len(command_and_args) == 0: 25 print("error: unix wrapper requires at least 1 arg") 26 return 2 42 """ This should provide the program name and all arguments in a list. 43 44 Only a single command should be called. 45 """ 46 arg_check = _args_check(command_and_args, simple_unix_wrapper.__name__) 47 if arg_check != 0: 48 return arg_check 27 49 28 50 try:
Note:
See TracChangeset
for help on using the changeset viewer.
