diff --git a/.python-flake8-config b/.flake8 similarity index 100% rename from .python-flake8-config rename to .flake8 diff --git a/netfoundry/ctl.py b/netfoundry/ctl.py index 7aaf42d..34fe585 100644 --- a/netfoundry/ctl.py +++ b/netfoundry/ctl.py @@ -13,7 +13,6 @@ import signal import jwt import tempfile -from builtins import list as blist from json import dumps as json_dumps from json import load as json_load from json import loads as json_loads @@ -43,9 +42,12 @@ from .organization import Organization from .utility import DC_PROVIDERS, EMBED_NET_RESOURCES, IDENTITY_ID_PROPERTIES, MUTABLE_NET_RESOURCES, MUTABLE_RESOURCE_ABBREV, RESOURCE_ABBREV, RESOURCES, any_in, get_generic_resource_by_type_and_id, normalize_caseless, plural, propid2type, singular -set_metadata(version=f"v{netfoundry_version}", author="NetFoundry", name="nfctl") # must precend import milc.cli -from milc import cli, questions # this uses metadata set above -from milc.subcommand import config # this creates the config subcommand +# must precend import milc.cli +set_metadata(version=f"v{netfoundry_version}", author="NetFoundry", name="nfctl") +# this uses metadata set above +from milc import cli, questions # noqa: E402 +# this creates the config subcommand +from milc.subcommand import config # noqa: F401,E402 if platform.system() == 'Linux': # this allows the app the terminate gracefully when piped to a truncating consumer like `head` diff --git a/netfoundry/network.py b/netfoundry/network.py index 9447de5..a0f10ff 100644 --- a/netfoundry/network.py +++ b/netfoundry/network.py @@ -4,6 +4,7 @@ import re import time +from packaging.version import parse from requests.exceptions import JSONDecodeError from netfoundry.exceptions import NetworkBoundaryViolation, UnknownResourceType @@ -56,7 +57,7 @@ def __init__(self, NetworkGroup: object, network_id: str = None, network_name: s self.product_version = self.describe['productVersion'] self.owner_identity_id = self.describe['ownerIdentityId'] self.size = self.describe['size'] - self.o365_breakout_category = self.describe['o365BreakoutCategory'] + self.o365_breakout_category = self.describe.get('o365BreakoutCategory') self.created_at = self.describe['createdAt'] self.updated_at = self.describe['updatedAt'] self.created_by = self.describe['createdBy'] @@ -1228,6 +1229,9 @@ def get_controller_session(self, id: str): Note that this function requires privileged access to the controller and is intended for emergency, read-only operations by customer support engineers. :param id: the UUID of the network controller """ + + if parse(self.product_version) >= parse("8.0.0"): + raise RuntimeError(f"get_controller_session() is unavailable in network version {self.product_version} and later.") url = self.audience+'core/v2/network-controllers/'+id+'/session' try: session, status_symbol = get_generic_resource_by_url(setup=self, url=url) diff --git a/setup.cfg b/setup.cfg index 14059a7..151defa 100644 --- a/setup.cfg +++ b/setup.cfg @@ -30,7 +30,7 @@ install_requires = pygments >= 2.11 pyjwt >= 2.3 pyyaml >= 5.4 - requests >= 2.27 + requests >= 2.27, < 2.30 tabulate >= 0.8 requests-cache >= 0.9.4 setup_requires =