Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
10 changes: 6 additions & 4 deletions netfoundry/ctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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`
Expand Down
6 changes: 5 additions & 1 deletion netfoundry/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import re
import time

from packaging.version import parse
from requests.exceptions import JSONDecodeError

from netfoundry.exceptions import NetworkBoundaryViolation, UnknownResourceType
Expand Down Expand Up @@ -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']
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
Loading