Compare commits

...

No commits in common. "c9-beta" and "c8" have entirely different histories.
c9-beta ... c8

5 changed files with 807 additions and 202 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/pywbem-0.15.0.tar.gz
SOURCES/v0.11.0.tar.gz

View File

@ -1 +1 @@
2c9621b483fa1c50edb9a15230724664d6fe64f8 SOURCES/pywbem-0.15.0.tar.gz
38a67bfd1723c49b586576dd693e5e8422a4d645 SOURCES/v0.11.0.tar.gz

View File

@ -1,76 +0,0 @@
diff --git a/minimum-constraints.txt b/minimum-constraints.txt
index a3ba9471..8dd066ca 100644
--- a/minimum-constraints.txt
+++ b/minimum-constraints.txt
@@ -56,7 +56,6 @@ wheel==0.33.6; python_version >= '3.8'
# Direct dependencies for install (must be consistent with requirements.txt)
M2Crypto==0.31.0
-mock==2.0.0
ordereddict==1.1
ply==3.10
PyYAML==3.11; python_version == '2.6'
diff --git a/pywbem_mock/_wbemconnection_mock.py b/pywbem_mock/_wbemconnection_mock.py
index e5dd0f8d..6ea95119 100644
--- a/pywbem_mock/_wbemconnection_mock.py
+++ b/pywbem_mock/_wbemconnection_mock.py
@@ -40,7 +40,7 @@ try:
from collections import Counter
except ImportError:
from backport_collections import Counter
-from mock import Mock
+from unittest.mock import Mock
import six
try:
diff --git a/requirements.txt b/requirements.txt
index 69a01d7c..f1287af2 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -11,7 +11,6 @@
# On Windows, M2Crypto must be installed via pywbem_os_setup.bat
M2Crypto>=0.31.0; python_version < '3.0' and sys_platform != 'win32'
-mock>=2.0.0
ordereddict>=1.1; python_version == '2.6'
ply>=3.10
PyYAML>=3.11,<3.12; python_version == '2.6' # yaml package
diff --git a/tests/unittest/pywbem/test_cim_obj.py b/tests/unittest/pywbem/test_cim_obj.py
index 3d0e3b80..e0d9e39f 100755
--- a/tests/unittest/pywbem/test_cim_obj.py
+++ b/tests/unittest/pywbem/test_cim_obj.py
@@ -12,7 +12,7 @@ from __future__ import absolute_import, print_function
import sys
import re
from datetime import timedelta, datetime
-from mock import patch
+from unittest.mock import patch
try:
from collections import OrderedDict
except ImportError:
diff --git a/tests/unittest/pywbem/test_itermethods.py b/tests/unittest/pywbem/test_itermethods.py
index 635bd130..7343f6fe 100644
--- a/tests/unittest/pywbem/test_itermethods.py
+++ b/tests/unittest/pywbem/test_itermethods.py
@@ -24,7 +24,7 @@ from __future__ import absolute_import, print_function
import pytest
import six
-from mock import Mock
+from unittest.mock import Mock
from ...utils import import_installed
pywbem = import_installed('pywbem') # noqa: E402
diff --git a/tests/unittest/pywbem/test_valuemapping.py b/tests/unittest/pywbem/test_valuemapping.py
index 27f86588..db31d3c3 100644
--- a/tests/unittest/pywbem/test_valuemapping.py
+++ b/tests/unittest/pywbem/test_valuemapping.py
@@ -7,7 +7,7 @@ from __future__ import absolute_import
import re
import pytest
-from mock import Mock
+from unittest.mock import Mock
from ...utils import import_installed
pywbem = import_installed('pywbem') # noqa: E402

View File

@ -0,0 +1,778 @@
Index: pywbem-0.11.0/attic/twisted_client.py
===================================================================
--- pywbem-0.11.0.orig/attic/twisted_client.py
+++ /dev/null
@@ -1,773 +0,0 @@
-#
-# (C) Copyright 2005,2007 Hewlett-Packard Development Company, L.P.
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
-# Author: Tim Potter <tpot@hp.com>
-#
-
-"""pywbem.twisted - WBEM client bindings for Twisted Python.
-
-This module contains factory classes that produce WBEMClient instances
-that perform WBEM requests over HTTP using the
-twisted.protocols.http.HTTPClient base class.
-"""
-
-import base64
-from datetime import datetime, timedelta
-try:
- from elementtree.ElementTree import fromstring, tostring
-except ImportError:
- from xml.etree.ElementTree import fromstring, tostring
-import six
-from six.moves import urllib
-
-from twisted.internet import reactor, protocol, defer
-from twisted.web import http #, client, error
-
-# TODO: Eww - we should get rid of the tupletree, tupleparse modules
-# and replace with elementtree based code.
-from . import cim_types, cim_xml, cim_obj, tupleparse, tupletree
-from .cim_obj import CIMClass, CIMClassName, CIMInstance, CIMInstanceName
-from .cim_operations import CIMError
-from .cim_types import CIMDateTime
-
-__all__ = ['WBEMClient', 'WBEMClientFactory', 'EnumerateInstances',
- 'EnumerateInstanceNames', 'GetInstance', 'DeleteInstance',
- 'CreateInstance', 'ModifyInstance', 'EnumerateClassNames',
- 'EnumerateClasses', 'GetClass', 'Associators', 'AssociatorNames',
- 'References', 'ReferenceNames', 'InvokeMethod', 'ExecQuery']
-
-class WBEMClient(http.HTTPClient):
- """A HTTPClient subclass that handles WBEM requests."""
-
- status = None
-
- def connectionMade(self):
- """Send a HTTP POST command with the appropriate CIM over HTTP
- headers and payload."""
-
- self.factory.request_xml = str(self.factory.payload)
-
- self.sendCommand('POST', '/cimom')
-
- self.sendHeader('Host', '%s:%d' %
- (self.transport.addr[0], self.transport.addr[1]))
- self.sendHeader('User-Agent', 'pywbem/twisted')
- self.sendHeader('Content-length', len(self.factory.payload))
- self.sendHeader('Content-type', 'application/xml')
-
- if self.factory.creds:
- auth = base64.b64encode('%s:%s' % (self.factory.creds[0],
- self.factory.creds[1]))
-
- self.sendHeader('Authorization', 'Basic %s' % auth)
-
- self.sendHeader('CIMOperation', str(self.factory.operation))
- self.sendHeader('CIMMethod', str(self.factory.method))
- self.sendHeader('CIMObject', str(self.factory.object))
-
- self.endHeaders()
-
- # TODO: Figure out why twisted doesn't support unicode. An
- # exception should be thrown by the str() call if the payload
- # can't be converted to the current codepage.
-
- self.transport.write(str(self.factory.payload))
-
- def handleResponse(self, data):
- """Called when all response data has been received."""
-
- self.factory.response_xml = data
-
- if self.status == '200':
- self.factory.parseErrorAndResponse(data)
-
- self.factory.deferred = None
- self.transport.loseConnection()
-
- def handleStatus(self, version, status, message):
- """Save the status code for processing when we get to the end
- of the headers."""
-
- self.status = status
- self.message = message
-
- def handleHeader(self, key, value):
- """Handle header values."""
-
- if key == 'CIMError':
- self.CIMError = urllib.parse.unquote(value)
- if key == 'PGErrorDetail':
- self.PGErrorDetail = urllib.parse.unquote(value)
-
- def handleEndHeaders(self):
- """Check whether the status was OK and raise an error if not
- using previously saved header information."""
-
- if self.status != '200':
-
- if not hasattr(self, 'cimerror') or \
- not hasattr(self, 'errordetail'):
-
- self.factory.deferred.errback(
- CIMError(0, 'HTTP error %s: %s' %
- (self.status, self.message)))
-
- else:
-
- self.factory.deferred.errback(
- CIMError(0, '%s: %s' % (cimerror, errordetail)))
-
-class WBEMClientFactory(protocol.ClientFactory):
- """Create instances of the WBEMClient class."""
-
- request_xml = None
- response_xml = None
- xml_header = '<?xml version="1.0" encoding="utf-8" ?>'
-
- def __init__(self, creds, operation, method, object, payload):
- self.creds = creds
- self.operation = operation
- self.method = method
- self.object = object
- self.payload = payload
- self.protocol = lambda: WBEMClient()
- self.deferred = defer.Deferred()
-
- def clientConnectionFailed(self, connector, reason):
- if self.deferred is not None:
- reactor.callLater(0, self.deferred.errback, reason)
-
- def clientConnectionLost(self, connector, reason):
- if self.deferred is not None:
- reactor.callLater(0, self.deferred.errback, reason)
-
- def imethodcallPayload(self, methodname, localnsp, **kwargs):
- """Generate the XML payload for an intrinsic methodcall."""
-
- param_list = [pywbem.IPARAMVALUE(x[0], pywbem.tocimxml(x[1]))
- for x in kwargs.items()]
-
- payload = cim_xml.CIM(
- cim_xml.MESSAGE(
- cim_xml.SIMPLEREQ(
- cim_xml.IMETHODCALL(
- methodname,
- cim_xml.LOCALNAMESPACEPATH(
- [cim_xml.NAMESPACE(ns)
- for ns in localnsp.split('/')]),
- param_list)),
- '1001', '1.0'),
- '2.0', '2.0')
-
- return self.xml_header + payload.toxml()
-
- def methodcallPayload(self, methodname, obj, namespace, **kwargs):
- """Generate the XML payload for an extrinsic methodcall."""
-
- if isinstance(obj, CIMInstanceName):
-
- path = obj.copy()
-
- path.host = None
- path.namespace = None
-
- localpath = cim_xml.LOCALINSTANCEPATH(
- cim_xml.LOCALNAMESPACEPATH(
- [cim_xml.NAMESPACE(ns)
- for ns in namespace.split('/')]),
- path.tocimxml())
- else:
- localpath = cim_xml.LOCALCLASSPATH(
- cim_xml.LOCALNAMESPACEPATH(
- [cim_xml.NAMESPACE(ns)
- for ns in namespace.split('/')]),
- obj)
-
- def paramtype(obj):
- """Return a string to be used as the CIMTYPE for a parameter."""
- if isinstance(obj, cim_types.CIMType):
- return obj.cimtype
- elif type(obj) == bool:
- return 'boolean'
- elif isinstance(obj, six.string_types):
- return 'string'
- elif isinstance(obj, (datetime, timedelta)):
- return 'datetime'
- elif isinstance(obj, (CIMClassName, CIMInstanceName)):
- return 'reference'
- elif isinstance(obj, (CIMClass, CIMInstance)):
- return 'string'
- elif isinstance(obj, list):
- return paramtype(obj[0])
- raise TypeError('Unsupported parameter type "%s"' % type(obj))
-
- def paramvalue(obj):
- """Return a cim_xml node to be used as the value for a
- parameter."""
- if isinstance(obj, (datetime, timedelta)):
- obj = CIMDateTime(obj)
- if isinstance(obj, (cim_types.CIMType, bool, six.string_types)):
- return cim_xml.VALUE(cim_types.atomic_to_cim_xml(obj))
- if isinstance(obj, (CIMClassName, CIMInstanceName)):
- return cim_xml.VALUE_REFERENCE(obj.tocimxml())
- if isinstance(obj, (CIMClass, CIMInstance)):
- return cim_xml.VALUE(obj.tocimxml().toxml())
- if isinstance(obj, list):
- if isinstance(obj[0], (CIMClassName, CIMInstanceName)):
- return cim_xml.VALUE_REFARRAY([paramvalue(x) for x in obj])
- return cim_xml.VALUE_ARRAY([paramvalue(x) for x in obj])
- raise TypeError('Unsupported parameter type "%s"' % type(obj))
-
- param_list = [cim_xml.PARAMVALUE(x[0],
- paramvalue(x[1]),
- paramtype(x[1]))
- for x in kwargs.items()]
-
- payload = cim_xml.CIM(
- cim_xml.MESSAGE(
- cim_xml.SIMPLEREQ(
- cim_xml.METHODCALL(methodname,
- localpath,
- param_list)),
- '1001', '1.0'),
- '2.0', '2.0')
-
- return self.xml_header + payload.toxml()
-
- def parseErrorAndResponse(self, data):
- """Parse returned XML for errors, then convert into
- appropriate Python objects."""
-
- xml = fromstring(data)
- error = xml.find('.//ERROR')
-
- if error is None:
- self.deferred.callback(self.parseResponse(xml))
- return
-
- try:
- code = int(error.attrib['CODE'])
- except ValueError:
- code = 0
-
- self.deferred.errback(CIMError(code, error.attrib['DESCRIPTION']))
-
- def parseResponse(self, xml):
- """Parse returned XML and convert into appropriate Python
- objects. Override in subclass"""
-
- pass
-
-class EnumerateInstances(WBEMClientFactory):
- """Factory to produce EnumerateInstances WBEM clients."""
-
- def __init__(self, creds, classname, namespace='root/cimv2', **kwargs):
-
- self.classname = classname
- self.namespace = namespace
-
- payload = self.imethodcallPayload(
- 'EnumerateInstances',
- namespace,
- ClassName=CIMClassName(classname),
- **kwargs)
-
- WBEMClientFactory.__init__(
- self,
- creds,
- operation='MethodCall',
- method='EnumerateInstances',
- object=namespace,
- payload=payload)
-
- def __repr__(self):
- return '<%s(/%s:%s) at 0x%x>' % \
- (self.__class__, self.namespace, self.classname, id(self))
-
- def parseResponse(self, xml):
-
- tt = [tupletree.xml_to_tupletree(tostring(x))
- for x in xml.findall('.//VALUE.NAMEDINSTANCE')]
-
- return [tupleparse.parse_value_namedinstance(x) for x in tt]
-
-class EnumerateInstanceNames(WBEMClientFactory):
- """Factory to produce EnumerateInstanceNames WBEM clients."""
-
- def __init__(self, creds, classname, namespace='root/cimv2', **kwargs):
-
- self.classname = classname
- self.namespace = namespace
-
- payload = self.imethodcallPayload(
- 'EnumerateInstanceNames',
- namespace,
- ClassName=CIMClassName(classname),
- **kwargs)
-
- WBEMClientFactory.__init__(
- self,
- creds,
- operation='MethodCall',
- method='EnumerateInstanceNames',
- object=namespace,
- payload=payload)
-
- def __repr__(self):
- return '<%s(/%s:%s) at 0x%x>' % \
- (self.__class__, self.namespace, self.classname, id(self))
-
- def parseResponse(self, xml):
-
- tt = [tupletree.xml_to_tupletree(tostring(x))
- for x in xml.findall('.//INSTANCENAME')]
-
- names = [tupleparse.parse_instancename(x) for x in tt]
-
- [setattr(n, 'namespace', self.namespace) for n in names]
-
- return names
-
-class GetInstance(WBEMClientFactory):
- """Factory to produce GetInstance WBEM clients."""
-
- def __init__(self, creds, instancename, namespace='root/cimv2', **kwargs):
-
- self.instancename = instancename
- self.namespace = namespace
-
- payload = self.imethodcallPayload(
- 'GetInstance',
- namespace,
- InstanceName=instancename,
- **kwargs)
-
- WBEMClientFactory.__init__(
- self,
- creds,
- operation='MethodCall',
- method='GetInstance',
- object=namespace,
- payload=payload)
-
- def __repr__(self):
- return '<%s(/%s:%s) at 0x%x>' % \
- (self.__class__, self.namespace, self.instancename, id(self))
-
- def parseResponse(self, xml):
-
- tt = tupletree.xml_to_tupletree(
- tostring(xml.find('.//INSTANCE')))
-
- return tupleparse.parse_instance(tt)
-
-class DeleteInstance(WBEMClientFactory):
- """Factory to produce DeleteInstance WBEM clients."""
-
- def __init__(self, creds, instancename, namespace='root/cimv2', **kwargs):
-
- self.instancename = instancename
- self.namespace = namespace
-
- payload = self.imethodcallPayload(
- 'DeleteInstance',
- namespace,
- InstanceName=instancename,
- **kwargs)
-
- WBEMClientFactory.__init__(
- self,
- creds,
- operation='MethodCall',
- method='DeleteInstance',
- object=namespace,
- payload=payload)
-
- def __repr__(self):
- return '<%s(/%s:%s) at 0x%x>' % \
- (self.__class__, self.namespace, self.instancename, id(self))
-
-class CreateInstance(WBEMClientFactory):
- """Factory to produce CreateInstance WBEM clients."""
-
- # TODO: Implement __repr__ method
-
- def __init__(self, creds, instance, namespace='root/cimv2', **kwargs):
-
- payload = self.imethodcallPayload(
- 'CreateInstance',
- namespace,
- NewInstance=instance,
- **kwargs)
-
- WBEMClientFactory.__init__(
- self,
- creds,
- operation='MethodCall',
- method='CreateInstance',
- object=namespace,
- payload=payload)
-
- def parseResponse(self, xml):
-
- tt = tupletree.xml_to_tupletree(
- tostring(xml.find('.//INSTANCENAME')))
-
- return tupleparse.parse_instancename(tt)
-
-class ModifyInstance(WBEMClientFactory):
- """Factory to produce ModifyInstance WBEM clients."""
-
- # TODO: Implement __repr__ method
-
- def __init__(self, creds, instancename, instance, namespace='root/cimv2',
- **kwargs):
-
- wrapped_instance = CIMInstanceName(instancename, instance)
-
- payload = self.imethodcallPayload(
- 'ModifyInstance',
- namespace,
- ModifiedInstance=wrapped_instance,
- **kwargs)
-
- WBEMClientFactory.__init__(
- self,
- creds,
- operation='MethodCall',
- method='ModifyInstance',
- object=namespace,
- payload=payload)
-
-class EnumerateClassNames(WBEMClientFactory):
- """Factory to produce EnumerateClassNames WBEM clients."""
-
- def __init__(self, creds, namespace='root/cimv2', **kwargs):
-
- self.localnsp = namespace
-
- payload = self.imethodcallPayload(
- 'EnumerateClassNames',
- namespace,
- **kwargs)
-
- WBEMClientFactory.__init__(
- self,
- creds,
- operation='MethodCall',
- method='EnumerateClassNames',
- object=namespace,
- payload=payload)
-
- def __repr__(self):
- return '<%s(/%s) at 0x%x>' % \
- (self.__class__, self.namespace, id(self))
-
- def parseResponse(self, xml):
-
- tt = [tupletree.xml_to_tupletree(tostring(x))
- for x in xml.findall('.//CLASSNAME')]
-
- return [tupleparse.parse_classname(x) for x in tt]
-
-class EnumerateClasses(WBEMClientFactory):
- """Factory to produce EnumerateClasses WBEM clients."""
-
- def __init__(self, creds, namespace='root/cimv2', **kwargs):
-
- self.localnsp = namespace
- self.namespace = namespace
-
- payload = self.imethodcallPayload(
- 'EnumerateClasses',
- namespace,
- **kwargs)
-
- WBEMClientFactory.__init__(
- self,
- creds,
- operation='MethodCall',
- method='EnumerateClasses',
- object=namespace,
- payload=payload)
-
- def __repr__(self):
- return '<%s(/%s) at 0x%x>' % \
- (self.__class__, self.namespace, id(self))
-
- def parseResponse(self, xml):
-
- tt = [tupletree.xml_to_tupletree(tostring(x))
- for x in xml.findall('.//CLASS')]
-
- return [tupleparse.parse_class(x) for x in tt]
-
-class GetClass(WBEMClientFactory):
- """Factory to produce GetClass WBEM clients."""
-
- def __init__(self, creds, classname, namespace='root/cimv2', **kwargs):
-
- self.classname = classname
- self.namespace = namespace
-
- payload = self.imethodcallPayload(
- 'GetClass',
- namespace,
- ClassName=CIMClassName(classname),
- **kwargs)
-
- WBEMClientFactory.__init__(
- self,
- creds,
- operation='MethodCall',
- method='GetClass',
- object=namespace,
- payload=payload)
-
- def __repr__(self):
- return '<%s(/%s:%s) at 0x%x>' % \
- (self.__class__, self.namespace, self.classname, id(self))
-
- def parseResponse(self, xml):
-
- tt = tupletree.xml_to_tupletree(
- tostring(xml.find('.//CLASS')))
-
- return tupleparse.parse_class(tt)
-
-class Associators(WBEMClientFactory):
- """Factory to produce Associators WBEM clients."""
-
- # TODO: Implement __repr__ method
-
- def __init__(self, creds, obj, namespace='root/cimv2', **kwargs):
-
- if isinstance(obj, CIMInstanceName):
- kwargs['ObjectName'] = obj
- else:
- kwargs['ObjectName'] = CIMClassName(obj)
-
- payload = self.imethodcallPayload(
- 'Associators',
- namespace,
- **kwargs)
-
- WBEMClientFactory.__init__(
- self,
- creds,
- operation='MethodCall',
- method='Associators',
- object=namespace,
- payload=payload)
-
-class AssociatorNames(WBEMClientFactory):
- """Factory to produce AssociatorNames WBEM clients."""
-
- # TODO: Implement __repr__ method
-
- def __init__(self, creds, obj, namespace='root/cimv2', **kwargs):
-
- if isinstance(obj, CIMInstanceName):
- kwargs['ObjectName'] = obj
- else:
- kwargs['ObjectName'] = CIMClassName(obj)
-
- payload = self.imethodcallPayload(
- 'AssociatorNames',
- namespace,
- **kwargs)
-
- WBEMClientFactory.__init__(
- self,
- creds,
- operation='MethodCall',
- method='AssociatorNames',
- object=namespace,
- payload=payload)
-
- def parseResponse(self, xml):
-
- if len(xml.findall('.//INSTANCENAME')) > 0:
-
- tt = [tupletree.xml_to_tupletree(tostring(x))
- for x in xml.findall('.//INSTANCENAME')]
-
- return [tupleparse.parse_instancename(x) for x in tt]
-
- else:
-
- tt = [tupletree.xml_to_tupletree(tostring(x))
- for x in xml.findall('.//OBJECTPATH')]
-
- return [tupleparse.parse_objectpath(x)[2] for x in tt]
-
-class References(WBEMClientFactory):
- """Factory to produce References WBEM clients."""
-
- def __init__(self, creds, obj, namespace='root/cimv2', **kwargs):
-
- if isinstance(obj, CIMInstanceName):
- kwargs['ObjectName'] = obj
- else:
- kwargs['ObjectName'] = CIMClassName(obj)
-
- payload = self.imethodcallPayload(
- 'References',
- namespace,
- **kwargs)
-
- WBEMClientFactory.__init__(
- self,
- creds,
- operation='MethodCall',
- method='References',
- object=namespace,
- payload=payload)
-
-class ReferenceNames(WBEMClientFactory):
- """Factory to produce ReferenceNames WBEM clients."""
-
- # TODO: Implement __repr__ method
-
- def __init__(self, creds, obj, namespace='root/cimv2', **kwargs):
-
- if isinstance(obj, CIMInstanceName):
- kwargs['ObjectName'] = obj
- else:
- kwargs['ObjectName'] = CIMClassName(obj)
-
- payload = self.imethodcallPayload(
- 'ReferenceNames',
- namespace,
- **kwargs)
-
- WBEMClientFactory.__init__(
- self,
- creds,
- operation='MethodCall',
- method='ReferenceNames',
- object=namespace,
- payload=payload)
-
- def parseResponse(self, xml):
-
- if len(xml.findall('.//INSTANCENAME')) > 0:
-
- tt = [tupletree.xml_to_tupletree(tostring(x))
- for x in xml.findall('.//INSTANCENAME')]
-
- return [tupleparse.parse_instancename(x) for x in tt]
-
- else:
-
- tt = [tupletree.xml_to_tupletree(tostring(x))
- for x in xml.findall('.//OBJECTPATH')]
-
- return [tupleparse.parse_objectpath(x)[2] for x in tt]
-
-class InvokeMethod(WBEMClientFactory):
- """Factory to produce InvokeMethod WBEM clients."""
-
- def __init__(self, creds, MethodName, ObjectName, namespace='root/cimv2',
- **kwargs):
-
- # Convert string to CIMClassName
-
- obj = ObjectName
-
- if isinstance(obj, six.string_types):
- obj = CIMClassName(obj, namespace=namespace)
-
- if isinstance(obj, CIMInstanceName) and obj.namespace is None:
- obj = ObjectName.copy()
- obj.namespace = namespace
-
- # Make the method call
-
- payload = self.methodcallPayload(
- MethodName,
- obj,
- namespace,
- **kwargs)
-
- WBEMClientFactory.__init__(
- self,
- creds,
- operation='MethodCall',
- method=MethodName,
- object=obj,
- payload=payload)
-
- def parseResponse(self, xml):
-
- # Return value of method
-
- result_xml = tupletree.xml_to_tupletree(
- tostring(xml.find('.//RETURNVALUE')))
-
- result_tt = tupleparse.parse_any(result_xml)
-
- result = cim_obj.tocimobj(result_tt[1]['PARAMTYPE'],
- result_tt[2])
-
- # Output parameters
-
- params_xml = [tupletree.xml_to_tupletree(tostring(x))
- for x in xml.findall('.//PARAMVALUE')]
-
- params_tt = [tupleparse.parse_any(x) for x in params_xml]
-
- params = {}
-
- for p in params_tt:
- if p[1] == 'reference':
- params[p[0]] = p[2]
- else:
- params[p[0]] = cim_obj.tocimobj(p[1], p[2])
-
- return (result, params)
-
-class ExecQuery(WBEMClientFactory):
-
- def __init__(self, creds, QueryLanguage, Query, namespace='root/cimv2'):
-
- self.QueryLanguage = QueryLanguage
- self.Query = Query
- self.namespace = namespace
-
- payload = self.imethodcallPayload(
- 'ExecQuery',
- namespace,
- QueryLanguage=QueryLanguage,
- Query=Query)
-
- WBEMClientFactory.__init__(
- self,
- creds,
- operation='MethodCall',
- method='ExecQuery',
- object=namespace,
- payload=payload)
-
- def __repr__(self):
- return '<%s(/%s:%s) at 0x%x>' % \
- (self.__class__, self.namespace, self.Query, id(self))
-
- def parseResponse(self, xml):
- tt = [pywbem.tupletree.xml_to_tupletree(tostring(x))
- for x in xml.findall('.//INSTANCE')]
- return [pywbem.tupleparse.parse_instance(x) for x in tt]

View File

@ -1,19 +1,19 @@
%{?python_enable_dependency_generator}
Name: pywbem
Version: 0.15.0
Epoch: 1
Release: 6%{?dist}
Summary: Python WBEM client interface and related utilities
Version: 0.11.0
Release: 8%{?dist}
Summary: Python WBEM Client and Provider Interface
Group: Development/Libraries
License: LGPLv2
URL: https://github.com/pywbem/pywbem
Source0: https://github.com/pywbem/pywbem/archive/v%{version}/%{name}-%{version}.tar.gz
Patch1: BZ_1922368.patch
BuildRequires: python3-pip python3-PyYAML python3-ply python3-rpm-macros
BuildRequires: python3-devel
Source0: https://github.com/pywbem/pywbem/archive/v%{version}.tar.gz
BuildRequires: python3-pip python3-PyYAML python3-ply python3-devel
BuildArch: noarch
%description
# Remove python-twisted module, we don't want twisted in RHEL
Patch1: pywbem-remove-twisted.patch
%global _description\
A Python library for making CIM (Common Information Model) operations over HTTP\
using the WBEM CIM-XML protocol. It is based on the idea that a good WBEM\
client should be easy to use and not necessarily require a large amount of\
@ -27,9 +27,13 @@ at http://www.dmtf.org/standards/wbem.\
It also provides a Python provider interface, and is the fastest and\
easiest way to write providers on the planet.
%description %_description
%package -n python3-pywbem
Group: Development/Libraries
Summary: Python3 WBEM Client and Provider Interface
BuildArch: noarch
Requires: python3-PyYAML python3-six python3-ply
%description -n python3-pywbem
A WBEM client allows issuing operations to a WBEM server, using the CIM
@ -40,16 +44,16 @@ for more information about WBEM.
%prep
%setup -q -n %{name}-%{version}
%autosetup -p1
%if 0%{?rhel}
%patch1 -p1
%endif
%build
CFLAGS="%{optflags}" %{__python3} setup.py build
%install
rm -rf %{buildroot}
env PYTHONPATH=%{buildroot}/%{python3_sitelib} \
%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
env PYTHONPATH=%{buildroot}/%{python3_sitelib} %{__python3} setup.py install -O1 --skip-build --root %{buildroot}
rm -rf %{buildroot}/usr/bin/*.bat
# wbemcli are conflicting with sblim-wbemcli
mv -v %{buildroot}/%{_bindir}/wbemcli %{buildroot}/%{_bindir}/pywbemcli
@ -57,124 +61,23 @@ sed -i -e 's/wbemcli/pywbemcli/' %{buildroot}/%{_bindir}/pywbemcli
mv -v %{buildroot}/%{_bindir}/wbemcli.py %{buildroot}/%{_bindir}/pywbemcli.py
%files -n python3-pywbem
%license LICENSE.txt
%{python3_sitelib}/*.egg-info
%{python3_sitelib}/pywbem/
%{python3_sitelib}/pywbem_mock/
%{_bindir}/mof_compiler
%{_bindir}/pywbemcli
%{_bindir}/pywbemcli.py
%doc README.rst
%changelog
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 1:0.15.0-6
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Wed Nov 6 2019 Tony Asleson <tasleson@redhat.com> - 0.11.0-8
- Fix the conflict with sblim-wbemcli: RHBZ #1757855
- Corrected warning about multiple file inclusion
* Wed Jun 23 2021 Tony Asleson <tasleson@redhat.com> - 1:0.15.0-5
- https://bugzilla.redhat.com/show_bug.cgi?id=1975381
* Wed Jun 13 2018 Petr Viktorin <pviktori@redhat.com> - 0.11.0-7
- Drop the python2 subpackage
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 1:0.15.0-4
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Tue Feb 9 2021 Tony Asleson <tasleson@redhat.com> 1:0.15.0-3
- https://bugzilla.redhat.com/show_bug.cgi?id=1922368
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1:0.15.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Fri Oct 23 2020 Tony Asleson <tasleson@redhat.com> - 0.15.0-1
- Update to 0.15.0 for python 3.8 fixes
* Thu Oct 1 2020 Tony Asleson <tasleson@redhat.com> - 0.14.6-8
- New build to do a multi-build
* Wed Sep 30 2020 Tony Asleson <tasleson@redhat.com> - 0.14.6-7
- Add epoch to override the newer version that cannot be installed.
* Tue Sep 1 2020 Tony Asleson <tasleson@redhat.com> - 0.14.6-6
- Fix build failure
Bad source: /builddir/build/SOURCES/pywbem-0.14.6.tar.gz: No such file or directory
* Tue Sep 1 2020 Tony Asleson <tasleson@redhat.com> - 0.14.6-5
- Go back to 0.14.6 ref. https://bugzilla.redhat.com/show_bug.cgi?id=1868128
* Mon Aug 10 2020 Gris Ge <fge@redhat.com> - 1.0.1-1
- Upgrade to 1.0.1
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.14.6-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 0.14.6-3
- Rebuilt for Python 3.9
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.14.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Thu Oct 17 2019 Tony Asleson <tasleson@redhat.com> - 0.14.6-1
- Upgrade to 0.14.6
* Mon Sep 23 2019 Gris Ge <fge@redhat.com> - 0.14.4-1
- Upgrade to 0.14.4
* Fri Sep 13 2019 Gris Ge <fge@redhat.com> - 0.14.3-5
- Fix pywbemcli ModuleNotFoundError: RHBZ #1743784
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 0.14.3-4
- Rebuilt for Python 3.8
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.14.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Sat Jul 13 2019 Gris Ge <fge@redhat.com> - 0.14.3-2
- Fix the conflict with sblim-wbemcli: RHBZ #1724104
* Sat Jul 13 2019 Gris Ge <fge@redhat.com> - 0.14.3-1
- Upgrade to 0.14.3 and removed python2 stuff
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.12.6-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Fri Jan 11 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.12.6-2
- Enable python dependency generator
* Wed Dec 26 2018 Gris Ge <fge@redhat.com> - 0.12.6-1
- Upgrade to 0.12.6
* Tue Jul 24 2018 Gris Ge <fge@redhat.com> - 0.12.4-1
- Upgrade to 0.12.4
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.12.3-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Mon Jul 02 2018 Miro Hrončok <mhroncok@redhat.com> - 0.12.3-5
- Rebuilt for Python 3.7
* Tue Jun 26 2018 Gris Ge <fge@redhat.com> - 0.12.3-4
- iAdd missing dependency -- python3-devel
* Tue Jun 26 2018 Gris Ge <fge@redhat.com> - 0.12.3-3
- Rebuild again with --target=f29-python.
* Thu Jun 21 2018 Gris Ge <fge@redhat.com> - 0.12.3-2
- Rebuilt for Python 3.7
* Tue May 22 2018 Gris Ge <fge@redhat.com> - 0.12.3-1
- Upgrade to 0.12.3
* Fri May 18 2018 Gris Ge <fge@redhat.com> - 0.12.2-3
- Fix build failure on F28- where python2 is enabled.
Use %license macro.
* Fri May 18 2018 Gris Ge <fge@redhat.com> - 0.12.2-2
- Remove python2 for F29+. Add missing python3-pbr runtime requirement.
* Fri May 04 2018 Gris Ge <fge@redhat.com> - 0.12.2-1
- Upgrade to 0.12.2.
* Wed Feb 14 2018 Iryna Shcherbina <ishcherb@redhat.com> - 0.11.0-6
- Update Python 2 dependency declarations to new packaging standards
(See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)
* Tue May 22 2018 Josh Boyer <jwboyer@redhat.coml - 0.11.0-6
- Remove python-twisted dependency (RHBZ 1561647)
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.11.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild