Skip to content
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

Merged
merged 7 commits into from
Nov 21, 2016
Merged

[Network] Fix Networking command issues and refactor folded arguments #1375

merged 7 commits into from
Nov 21, 2016

Conversation

tjprescott
Copy link
Member

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 old register_folded_cli_argument. Once the VM module is refactored, register_folder_cli_argument will be removed.

Also:

  • Updates poor quality help text for several networking commands
  • Adds --make-primary to network nic ip-config create/update to enable multi-IP config scenarios on NICs.
  • Fixes issue with VPN connection deployment template.
  • Fixes issue where network nic ip-config create returns the NIC object instead of the IP config object. Breaking Change
  • Re-enables a VMSS test that had been commented out.
  • Updates the dump_command_table.py script to work with the recent perf improvements.

@tjprescott tjprescott added Breaking Change bug This issue requires a change to an existing behavior in the product in order to be resolved. Network az network vnet/lb/nic/dns/etc... labels Nov 18, 2016
@tjprescott tjprescott added this to the Sprint 7 milestone Nov 18, 2016
@mention-bot
Copy link

@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.

@tjprescott tjprescott changed the title Fix nic create [Network] Fix Networking command issues and refactor folded arguments Nov 18, 2016
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:
Copy link
Contributor

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))
Copy link
Contributor

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')
Copy link
Contributor

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?

Copy link
Member Author

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')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

headers:
Accept: [application/json]
Accept-Encoding: ['gzip, deflate']
Authorization: [Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IlJyUXF1OXJ5ZEJWUldtY29jdVhVYjIwSEdSTSIsImtpZCI6IlJyUXF1OXJ5ZEJWUldtY29jdVhVYjIwSEdSTSJ9.eyJhdWQiOiJodHRwczovL21hbmFnZW1lbnQuY29yZS53aW5kb3dzLm5ldC8iLCJpc3MiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC81NDgyNmIyMi0zOGQ2LTRmYjItYmFkOS1iN2I5M2EzZTljNWEvIiwiaWF0IjoxNDc5NDg4Nzg5LCJuYmYiOjE0Nzk0ODg3ODksImV4cCI6MTQ3OTQ5MjY4OSwiYWNyIjoiMSIsImFtciI6WyJwd2QiXSwiYXBwaWQiOiIwNGIwNzc5NS04ZGRiLTQ2MWEtYmJlZS0wMmY5ZTFiZjdiNDYiLCJhcHBpZGFjciI6IjAiLCJlX2V4cCI6MTA4MDAsImZhbWlseV9uYW1lIjoiQWR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comment

The reason will be displayed to describe this comment to others. Learn more.

scrube this

@tjprescott tjprescott merged commit fb95934 into Azure:master Nov 21, 2016
@tjprescott tjprescott deleted the FixNicCreate branch November 21, 2016 18:17
@haroldrandom haroldrandom added Breaking Change bug This issue requires a change to an existing behavior in the product in order to be resolved. cla-not-required Network az network vnet/lb/nic/dns/etc... labels Oct 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Breaking Change bug This issue requires a change to an existing behavior in the product in order to be resolved. cla-not-required Network az network vnet/lb/nic/dns/etc...
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants