Skip to content

Commit 8dba3fb

Browse files
authored
Merge pull request #49 from netfoundry/optional-o365BreakoutCategory
Optional o365 breakout category
2 parents 3eee2ae + 9b72a47 commit 8dba3fb

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed
File renamed without changes.

netfoundry/ctl.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import signal
1414
import jwt
1515
import tempfile
16-
from builtins import list as blist
1716
from json import dumps as json_dumps
1817
from json import load as json_load
1918
from json import loads as json_loads
@@ -43,9 +42,12 @@
4342
from .organization import Organization
4443
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
4544

46-
set_metadata(version=f"v{netfoundry_version}", author="NetFoundry", name="nfctl") # must precend import milc.cli
47-
from milc import cli, questions # this uses metadata set above
48-
from milc.subcommand import config # this creates the config subcommand
45+
# must precend import milc.cli
46+
set_metadata(version=f"v{netfoundry_version}", author="NetFoundry", name="nfctl")
47+
# this uses metadata set above
48+
from milc import cli, questions # noqa: E402
49+
# this creates the config subcommand
50+
from milc.subcommand import config # noqa: F401,E402
4951

5052
if platform.system() == 'Linux':
5153
# this allows the app the terminate gracefully when piped to a truncating consumer like `head`

netfoundry/network.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import re
55
import time
66

7+
from packaging.version import parse
78
from requests.exceptions import JSONDecodeError
89

910
from netfoundry.exceptions import NetworkBoundaryViolation, UnknownResourceType
@@ -56,7 +57,7 @@ def __init__(self, NetworkGroup: object, network_id: str = None, network_name: s
5657
self.product_version = self.describe['productVersion']
5758
self.owner_identity_id = self.describe['ownerIdentityId']
5859
self.size = self.describe['size']
59-
self.o365_breakout_category = self.describe['o365BreakoutCategory']
60+
self.o365_breakout_category = self.describe.get('o365BreakoutCategory')
6061
self.created_at = self.describe['createdAt']
6162
self.updated_at = self.describe['updatedAt']
6263
self.created_by = self.describe['createdBy']
@@ -1228,6 +1229,9 @@ def get_controller_session(self, id: str):
12281229
Note that this function requires privileged access to the controller and is intended for emergency, read-only operations by customer support engineers.
12291230
:param id: the UUID of the network controller
12301231
"""
1232+
1233+
if parse(self.product_version) >= parse("8.0.0"):
1234+
raise RuntimeError(f"get_controller_session() is unavailable in network version {self.product_version} and later.")
12311235
url = self.audience+'core/v2/network-controllers/'+id+'/session'
12321236
try:
12331237
session, status_symbol = get_generic_resource_by_url(setup=self, url=url)

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ install_requires =
3030
pygments >= 2.11
3131
pyjwt >= 2.3
3232
pyyaml >= 5.4
33-
requests >= 2.27
33+
requests >= 2.27, < 2.30
3434
tabulate >= 0.8
3535
requests-cache >= 0.9.4
3636
setup_requires =

0 commit comments

Comments
 (0)