-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Network] Fix Networking command issues and refactor folded arguments #1375
Conversation
@tjprescott, thanks for your PR! By analyzing the history of the files in this pull request, we identified @derekbekoe, @BurtBiel and @yugangw-msft to be potential reviewers. |
help_text = 'Name or ID of an existing {}.'.format(display_name) | ||
elif not allow_new and allow_none and not default_none: | ||
help_text = 'Name or ID of an existing {}, or {} for none.'.format(display_name, quotes) | ||
elif allow_new and not allow_none and not default_none: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and not default_none
is not needed, as the first if block has excluded this case already.
# if a parent name was required but not specified, raise a usage error | ||
if has_parent and not value_was_id and not parent_val and not allow_new: | ||
raise ValueError('incorrect usage: {} ID | {} NAME {} NAME'.format( | ||
property_option, property_option, parent_option)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can use 'incorrect usage: {0} ID | {0} NAME ...
to save an occurrence of property_option
raise argparse.ArgumentError( | ||
None, 'Must specify a subnet OR a public IP address, not both.') | ||
raise ValueError( | ||
'incorrect usage: --subnet NAME_OR_ID [--vnet-name NAME] | --public-ip NAME_OR_ID') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it be 'incorrect usage: --subnet NAME --vnet-name NAME | --subnet ID | --public-ip NAME_OR_ID
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I like that even better.
|
||
if namespace.subnet and namespace.public_ip_address: | ||
raise ValueError( | ||
'incorrect usage: --subnet NAME_OR_ID [--vnet-name NAME] | --public-ip NAME_OR_ID') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more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diOTNhM2U5YzVhIiwidW5pcXVlX25hbWUiOiJhZG1pbjJAQXp1cmVTREtUZWFtLm9ubWljcm9zb2Z0LmNvbSIsInVwbiI6ImFkbWluMkBBenVyZVNES1RlYW0ub25taWNyb3NvZnQuY29tIiwidmVyIjoiMS4wIiwid2lkcyI6WyI2MmU5MDM5NC02OWY1LTQyMzctOTE5MC0wMTIxNzcxNDVlMTAiXX0.ByWZCGTYEoUyY8abc1y-td4_jraXQzd9hTEj6QPB31ZB87OHRaCFM204G6xSgGJfi-TrjS7nTS9JYBGIQUnJwjghZEPLgacjO-YxAo2gYMMLEHsT-r3wnh3MMxsJvNZg0VffXDIbSVl3B23_QiNJ-vUmfFVGeMwuNDArhTMzII4P-o4dzmr3As_pL1qR_6ZBcYrPZO7iQtfc_4zvu_a_1_XUoHIbq9gT-_xYWIMNJ5tTkuEBf26K4CMB7fJLEC5U19AVme8lySwzFUtZJs9pF7icAfUBZIyttjPp1yc15nuck1LBjiWE68LrDfNAw1DfACkKgKV2kjseVXWCiPV3TQ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scrube this
Fixes #1237, fixes #1238, fixes #920
Replaces instances of
register_folded_cli_argument
in the network module with simpler solutions. Overall, improves the help and validation of the affected parameters while also simplifying the heavily parameterized logic of the oldregister_folded_cli_argument
. Once the VM module is refactored,register_folder_cli_argument
will be removed.Also:
dump_command_table.py
script to work with the recent perf improvements.