From f90c6e2fd9299c66c96a39f1b5baa2b3b5f2f30b Mon Sep 17 00:00:00 2001 From: Petr Jancik Date: Tue, 4 Apr 2023 15:13:18 +0200 Subject: [PATCH] change client REST port to 17774 adjust SolarWinds class to be able to override port for changes to main OrionSDK and rationale behind the change see https://github.com/solarwinds/OrionSDK/pull/333#pullrequestreview-1326783237 --- orionsdk/__init__.py | 2 +- orionsdk/solarwinds.py | 7 ++++--- orionsdk/swisclient.py | 2 +- setup.py | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/orionsdk/__init__.py b/orionsdk/__init__.py index f6ffb2c..e426a32 100644 --- a/orionsdk/__init__.py +++ b/orionsdk/__init__.py @@ -16,4 +16,4 @@ from .solarwinds import SolarWinds -__version__ = "0.3.0" +__version__ = "0.4.0" diff --git a/orionsdk/solarwinds.py b/orionsdk/solarwinds.py index 9fa5c1b..76e8089 100644 --- a/orionsdk/solarwinds.py +++ b/orionsdk/solarwinds.py @@ -4,6 +4,7 @@ The following class is used to create an object representing a SolarWinds Orion instance. The object provides simple getter and setter methods for common SolarWinds actions. These methods abstract out the underlying details and SWQL calls making SolarWinds automation more accessible to a broader audience. +Pass in port 17778 for pre-2023.1 Orion Platform. """ @@ -13,12 +14,12 @@ class SolarWinds: - def __init__(self, npm_server, username, password, logger=None): - + def __init__(self, npm_server, username, password, logger=None, port=17774): + self.logger = logger or logging.getLogger('__name__') # Create the SWIS client for use throughout the instance. - self.swis = SwisClient(npm_server, username, password) + self.swis = SwisClient(npm_server, username, password, port) def does_node_exist(self, node_name): """ Checks to see if a SolarWinds node exists with the given name. Calls the get_node_id method of the class diff --git a/orionsdk/swisclient.py b/orionsdk/swisclient.py index 13cfa9d..4f72300 100644 --- a/orionsdk/swisclient.py +++ b/orionsdk/swisclient.py @@ -11,7 +11,7 @@ def _json_serial(obj): class SwisClient: - def __init__(self, hostname, username, password, port=17778, verify=False, session=None): + def __init__(self, hostname, username, password, port=17774, verify=False, session=None): self.url = "https://{}:{}/SolarWinds/InformationService/v3/Json/".\ format(hostname, port) self._session = session or requests.Session() diff --git a/setup.py b/setup.py index 072f51e..adcf6e9 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ setup( name="orionsdk", - version="0.3.0", # Update also in __init__ ; + version="0.4.0", # Update also in __init__ ; description="Python API for the SolarWinds Orion SDK", long_description="Python client for interacting with the SolarWinds Orion API", author="SolarWinds",