Skip to content

Instantly share code, notes, and snippets.

@RyanKor
Created November 9, 2021 15:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RyanKor/b3c0e3a2b4f1d6f12184610b86a2e202 to your computer and use it in GitHub Desktop.
Save RyanKor/b3c0e3a2b4f1d6f12184610b86a2e202 to your computer and use it in GitHub Desktop.
class ReplaceNetwork(common.NeutronCommandWithExtraArgs):
_description = _("Replace network properties")
def get_parser(self, prog_name):
parser = super(ReplaceNetwork, self).get_parser(prog_name)
parser.add_argument(
'network',
metavar="<network>",
help=_("Network to modify (name or ID)")
)
_tag.add_tag_option_to_parser_for_set(parser, _('network'))
return parser
def take_action(self, parsed_args):
client = self.app.client_manager.network
obj = client.find_network(parsed_args.network, ignore_missing=False)
attrs = self._parse_extra_properties(parsed_args.extra_properties)
if attrs:
client.update_network(obj, **attrs)
# tags is a subresource and it needs to be updated separately.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment