If the configuration filename is not given, then the error is detected:
jeffs@jeffs-desktop:/home/jeffs/python/nbmdt (i2mac+network) * $ python3 nbmdt.py --diagnose
...
Traceback (most recent call last):
File "nbmdt.py", line 427, in <module>
main()
File "nbmdt.py", line 306, in main
raise ValueError("You did not specify a configuration filename when you asked nbmdt to diagnose a system")
ValueError: You did not specify a configuration filename when you asked nbmdt to diagnose a system
jeffs@jeffs-desktop:/home/jeffs/python/nbmdt (i2mac+network) * $
While I am at it, add single letter options.
Also, look at the difference between action="store_true" and action="store_constant". So for example, instead of:
group.add_argument('--boot', '-b', help="Use at boot time. Outputs messages color coded with status of network "
"subsystems, and then exits", action="store_true", dest="boot")
Try:
group.add_argument('--boot', '-b', help="Use at boot time. Outputs messages color coded with status of network "
"subsystems, and then exits", action="store_const", dest="mode", const=constants.Modes.BOOT)
Then I can get rid of that tangles if... at the end of arg_parser.
I have modified nbmdt.py and test_nbmdt.py to deal with the problem, including how to test for it. See commits 24a119bc3e76c0c6e085c09ab4bfa4054b7b4bd1 and 8a195a9cd76c53a10d9209b8b9712ea644b21af3
The parser does not understand when the configuration file is given:
Note that the help message (from the parser) is wrong. It should be something like:
If the configuration filename is not given, then the error is detected:
While I am at it, add single letter options.
Also, look at the difference between action="store_true" and action="store_constant". So for example, instead of:
Try:
Then I can get rid of that tangles if... at the end of
arg_parser
.