Skip to content

Commit

Permalink
change client REST port to 17774
Browse files Browse the repository at this point in the history
adjust SolarWinds class to be able to override port

for changes to main OrionSDK and rationale behind the change see
solarwinds/OrionSDK#333 (review)
  • Loading branch information
petr-jancik-swi committed Apr 4, 2023
1 parent 8157f80 commit f90c6e2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion orionsdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
from .solarwinds import SolarWinds


__version__ = "0.3.0"
__version__ = "0.4.0"
7 changes: 4 additions & 3 deletions orionsdk/solarwinds.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion orionsdk/swisclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit f90c6e2

Please sign in to comment.