Skip to content

Commit

Permalink
Release 1.2.488
Browse files Browse the repository at this point in the history
  • Loading branch information
jagadeeshnv committed Jan 25, 2022
1 parent 3de6e65 commit af398fe
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 40 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ Dell EMC OpenManage Python SDK is supported for python 2.7 and above.
``` pip3 install -r requirements-python3x.txt ```

# Installation
* This branch contains the build version 1.2.481
* This branch contains the build version 1.2.488
* Install the latest development version from github:

```
git clone https://github.com/dell/omsdk.git
cd omsdk
sh build.sh 1.2 481
sh build.sh 1.2 488
cd dist
pip install omsdk-1.2.481-py2.py3-none-any.whl
pip install omsdk-1.2.488-py2.py3-none-any.whl
```
* If omsdk build creation fails due to `python` command error, configure
`python` to launch either `python2` or `python3`. Accordingly configure the `pip` command.
Expand All @@ -40,7 +40,7 @@ Dell EMC OpenManage Python SDK is supported for python 2.7 and above.

* Downgrade pip version to lower than 10.0 and then install omsdk
* Force install omsdk using:
```pip install --ignore-installed omsdk-1.2.481-py2.py3-none-any.whl```
```pip install --ignore-installed omsdk-1.2.488-py2.py3-none-any.whl```
# Uninstallation
* Uninstall this module as follows:
Expand Down
4 changes: 2 additions & 2 deletions omdrivers/lifecycle/iDRAC/iDRACJobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,15 +349,15 @@ def get_job_status_redfish(self, jobid):
return jobdetail

jobdetail_data = jobdetail['Data']['Jobs']
if (jobdetail_data['PercentComplete'] < 100) or (100 < jobdetail_data['PercentComplete']):
if jobdetail_data.get('PercentComplete') is not None and (
(jobdetail_data.get('PercentComplete') < 100) or (100 < jobdetail_data.get('PercentComplete'))):
jobstaten = JobStatusEnum.InProgress
elif jobdetail_data['JobState'] == 'Completed':
jobstaten = self.get_job_status_by_msgid(jobdetail_data['MessageId'])
elif jobdetail_data['JobState'] == 'Failed' or 'Errors' in jobdetail_data['JobState']:
jobstaten = JobStatusEnum.Failed
else:
jobstaten = JobStatusEnum.Invalid

jobdetail_data['Status'] = TypeHelper.resolve(jobstaten)
return jobdetail_data

Expand Down
40 changes: 20 additions & 20 deletions omsdk/http/sdkhttpep.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,6 @@
#
# Authors: Vaideeswaran Ganesan
#
import sys
import io
import logging
import traceback
import json
from enum import Enum

import xml.etree.ElementTree as ET

import requests
import requests.adapters
import requests.exceptions
Expand All @@ -50,14 +41,16 @@


class HttpEndPointOptions(object):
def __init__(self, enid, authentication, port, connection_timeout, read_timeout, max_retries, verify_ssl):
def __init__(self, enid, authentication, port, connection_timeout, read_timeout, max_retries,
verify_ssl, cert):
self.enid = enid
self.connection_timeout = connection_timeout # establish a connection
self.read_timeout = read_timeout # how long to wait for response from client
self.max_retries = max_retries
self.verify_ssl = verify_ssl
self.authentication = authentication
self.port = port
self.max_retries = max_retries
self.verify_ssl = verify_ssl
self.cert = cert
self.authentication = authentication
self.port = port
#self.skip_ca_check = True
#self.skip_cn_check = True

Expand Down Expand Up @@ -96,15 +89,17 @@ def connect(self):
if self.session:
return True
self._logger.debug("Attempting a connection to device")
requests.packages.urllib3.disable_warnings(InsecurePlatformWarning)
requests.packages.urllib3.disable_warnings(SNIMissingWarning)
if not self.pOptions.verify_ssl:
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
# requests.packages.urllib3.disable_warnings(InsecurePlatformWarning)
# requests.packages.urllib3.disable_warnings(SNIMissingWarning)
# if not self.pOptions.verify_ssl:
# requests.packages.urllib3.disable_warnings(InsecureRequestWarning)

self.adapter = requests.adapters.HTTPAdapter(
pool_connections = 1,
max_retries = self.pOptions.max_retries)
self.session = requests.Session()
self.session.verify = self.pOptions.verify_ssl
self.session.cert = self.pOptions.cert
self.session.auth = None
if self.pOptions.authentication == AuthenticationType.Basic:
self.session.auth = requests.auth.HTTPBasicAuth(self.creds.username,
Expand Down Expand Up @@ -134,9 +129,14 @@ def ship_payload(self, payload):
# Submit the http request
self._logger.debug("Begin submitting POST request")
try:
response = self.session.send(prepared_request, verify=self.pOptions.verify_ssl,
response = self.session.send(prepared_request,
verify=self.pOptions.verify_ssl, cert=self.pOptions.cert,
timeout=(self.pOptions.connection_timeout, self.pOptions.read_timeout))
except requests.exceptions.ConnectionError:
except requests.exceptions.SSLError as sslerr:
error_message = "SSL connection error"
self._logger.debug(error_message)
raise HttpEndPointProtocolException(error_message)
except requests.exceptions.ConnectionError as cxerr:
error_message = "HTTP connection error"
self._logger.debug(error_message)
raise HttpEndPointProtocolException(error_message)
Expand Down
7 changes: 4 additions & 3 deletions omsdk/http/sdkredfishbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class RedfishOptions(HttpEndPointOptions):
"""
def __init__(
self, urlbase='redfish/v1', authentication = AuthenticationType.Basic, port = 443, connection_timeout = 20,
read_timeout = 30, max_retries = 1, verify_ssl = False, cacheTimeout=180
read_timeout = 30, max_retries = 1, verify_ssl = False, cert=None, cacheTimeout=180
):
"""
:param authentication: HTTP Authentication type 'Basic', 'Digest'
Expand All @@ -65,12 +65,12 @@ def __init__(
if PY2:
super(RedfishOptions, self).__init__(
ProtocolEnum.REDFISH, authentication, port, connection_timeout,
read_timeout, max_retries, verify_ssl
read_timeout, max_retries, verify_ssl, cert
)
else:
super().__init__(
ProtocolEnum.REDFISH, authentication, port, connection_timeout,
read_timeout, max_retries, verify_ssl
read_timeout, max_retries, verify_ssl, cert
)
self.enid = ProtocolEnum.REDFISH
self.urlbase = urlbase
Expand All @@ -89,6 +89,7 @@ def __init__(self, ipaddr, creds, pOptions):
self.session = requests.session()
self.pOptions = pOptions
self.session.verify = self.pOptions.verify_ssl
self.session.cert = self.pOptions.cert
if not self.pOptions.verify_ssl:
requests.packages.urllib3.disable_warnings()
if self.pOptions.authentication == AuthenticationType.Basic:
Expand Down
12 changes: 7 additions & 5 deletions omsdk/http/sdkrestbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@
logger = logging.getLogger(__name__)
class RestOptions(HttpEndPointOptions):
def __init__(self, authentication = AuthenticationType.Basic, port = 443, connection_timeout = 20,
read_timeout = 30, max_retries = 1, verify_ssl = False, cacheTimeout=180 ):
read_timeout = 30, max_retries = 1, verify_ssl = False, cert=None, cacheTimeout=180 ):
if PY2:
super(RestOptions, self).__init__(ProtocolEnum.REST, authentication, port, connection_timeout, read_timeout, max_retries,
verify_ssl)
verify_ssl, cert)
else:
super().__init__(ProtocolEnum.REST, authentication, port, connection_timeout, read_timeout, max_retries,
verify_ssl)
verify_ssl, cert)


class RestProtocolBase(ProtocolBase):
Expand Down Expand Up @@ -119,7 +119,8 @@ def get_token(self):
user_details = self.username + '_' + self.password
auth_string = hashlib.sha256(user_details.encode('utf-8')).hexdigest()
headers = {'datatype': 'json'}
login_response = requests.get(url + '/api/login/' + auth_string, headers=headers, verify=False)
login_response = requests.get(url + '/api/login/' + auth_string, headers=headers,
verify=self.pOptions.verify_ssl, cert=self.pOptions.cert)
if login_response:
response = json.loads(login_response.content)
if response['status'][0]['response-type'] == 'Success':
Expand All @@ -144,7 +145,8 @@ def _parse_output(self, clsName, resource):
if sessionKey:
try:
headers = {'sessionKey': sessionKey, 'datatype': 'json'}
api_response = requests.get(url + resource['url'], headers=headers, verify=False)
api_response = requests.get(url + resource['url'], headers=headers,
verify=self.pOptions.verify_ssl, cert=self.pOptions.cert)
if api_response.ok:
response = json.loads(api_response.content)
if api_response.ok:
Expand Down
6 changes: 3 additions & 3 deletions omsdk/http/sdkwsmanbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class WsManOptions(HttpEndPointOptions):

def __init__(
self, authentication=AuthenticationType.Basic, port=443, connection_timeout=20,
read_timeout=30, max_retries=1, verify_ssl=False
read_timeout=30, max_retries=1, verify_ssl=False, cert = None
):
"""
:param authentication: HTTP Authentication type 'Basic', 'Digest'
Expand All @@ -85,12 +85,12 @@ def __init__(
if PY2:
super(WsManOptions, self).__init__(
ProtocolEnum.WSMAN, authentication, port, connection_timeout,
read_timeout, max_retries, verify_ssl
read_timeout, max_retries, verify_ssl, cert
)
else:
super().__init__(
ProtocolEnum.WSMAN, authentication, port, connection_timeout,
read_timeout, max_retries, verify_ssl
read_timeout, max_retries, verify_ssl, cert
)
self.enid = ProtocolEnum.WSMAN

Expand Down
4 changes: 2 additions & 2 deletions omsdk/sdkinfra.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ def _create_driver(self, mod, host, creds, protopref, pOptions):
result = socket.getaddrinfo(host, None)
lastuple = result[-1]
ipaddress = lastuple[-1][0]
if ipaddress:
ipaddr = ipaddress
# if ipaddress:
# ipaddr = ipaddress
except socket.gaierror as err:
logger.error("{}: {}: {}".format(host, err, "cannot resolve hostname!"))
if not mod in self.disc_modules:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
long_description = f.read()

# Update the package version here
omsdk_ver = '1.2.481'
omsdk_ver = '1.2.488'

# conditional dependency:include enum34 if python 2 is in use
debug_l1_en = False
Expand Down

0 comments on commit af398fe

Please sign in to comment.