Skip to content

Commit

Permalink
Move fixes for pr656 back to 0.10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
KSchopmeyer committed Jan 18, 2017
1 parent d4edafc commit 1145729
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 93 deletions.
30 changes: 30 additions & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,36 @@ contains the `master` branch up to this commit:
:revisions: 1


pywbem v0.10.1.dev0
-------------------

Released: Not yet

Incompatible changes
^^^^^^^^^^^^^^^^^^^^

Enhancements
^^^^^^^^^^^^

Bug fixes
^^^^^^^^^

* Fix issue with MaxObjectCount on PullInstances and PullInstancePaths
CIM_Operations.py methods. The MaxObjectCount was defined as a keyword
parameter where it should have been be positional. This should NOT impact
clients unless they did not supply the parameter at all so that the result
was None which is illegal(Pull... operations MUST include MaxObjectCount).
In that case, server should return error.
Also extends these requests to test the Pull.. methods for valid
MaxObjectCount and context parameters. See issue #656.

Build, test, quality
^^^^^^^^^^^^^^^^^^^^

Documentation
^^^^^^^^^^^^^


pywbem v0.10.0
--------------

Expand Down
97 changes: 55 additions & 42 deletions pywbem/cim_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,24 @@ def _validateIterCommonParams(MaxObjectCount, OperationTimeout):
OperationTimeout)


def _validatePullParams(MaxObjectCount, context):
"""
Validate the input paramaters for the PullInstances,
PullInstancesWithPath, and PullInstancePaths requests.
MaxObjectCount: Must be integer type and ge 0
context: Must be not None and length ge 2
"""
if (not isinstance(MaxObjectCount, six.integer_types) or
MaxObjectCount < 0):
raise ValueError('MaxObjectCount parameter must be integer >= 0 but '
' is %s' % MaxObjectCount)
if context is None or len(context) < 2:
raise ValueError('Pull... Context parameter must be valid tuple %s'
% context)


class WBEMConnection(object): # pylint: disable=too-many-instance-attributes
"""
A client's connection to a WBEM server. This is the main class of the
Expand Down Expand Up @@ -1987,7 +2005,7 @@ def IterEnumerateInstancePaths(self, ClassName, namespace=None,
MaxObjectCount=DEFAULT_ITER_MAXOBJECTCOUNT,
**extra):
"""
A generator function to retrieve instances from a WBEM Server.
A generator function to retrieve instance paths from a WBEM Server.
This method frees the user of choices between the multiple
EnumerateInstances/OpenEnumerateInstance methods and reduces
the enumeration to a pythonic iterator idiom.
Expand Down Expand Up @@ -2374,11 +2392,10 @@ class (or subclasses).
* If positive, the WBEM server is to return no more than the
specified number of instances.
* Zero is not allowed; it would mean that zero instances
are to be returned for every request issued to the server.
* If `None`, this parameter is not passed to the WBEM server, and
causes the server-implemented default behaviour to be used.
:term:`DSP0200` defines that the server-implemented default is
to return zero instances.
are to be returned for open and all pull requests issued to the
server.
* The default is defined as a system config variable.
* `None` is not allowed.
Keyword Arguments:
Expand Down Expand Up @@ -2641,13 +2658,11 @@ class (or subclasses).
* If positive, the WBEM server is to return no more than the
specified number of instances.
* If zero, the WBEM server is to return no instances. This may
be used by a client to leave the handling of any returned
instances to a loop of Pull operations.
* If `None`, this parameter is not passed to the WBEM server, and
causes the server-implemented default behaviour to be used.
:term:`DSP0200` defines that the server-implemented default is
to return zero instances.
* Zero is not allowed; it would mean that zero instances
are to be returned for open and all pull requests issued to the
server.
* The default is defined as a system config variable.
* `None` is not allowed.
Keyword Arguments:
Expand Down Expand Up @@ -2765,9 +2780,9 @@ def IterAssociatorInstancePaths(self, InstanceName, AssocClass=None,
**extra):
# pylint: disable=invalid-name
"""
A generator function to retrieve associators from a WBEM Server.
A generator function to retrieve associator paths from a WBEM Server.
This method frees the user of choices between the multiple
AssociatorNames/AssociatorInstancePaths methods and reduces
AssociatorNames/OpenAssociatorInstancePaths methods and reduces
the enumeration to a pythonic iterator idiom.
**Experimental:** This method is experimental in this release.
Expand Down Expand Up @@ -2907,11 +2922,10 @@ class (or subclasses).
* If positive, the WBEM server is to return no more than the
specified number of instances.
* Zero is not allowed; it would mean that zero instances
are to be returned for every request issued to the server.
* If `None`, this parameter is not passed to the WBEM server, and
causes the server-implemented default behaviour to be used.
:term:`DSP0200` defines that the server-implemented default is
to return zero instances.
are to be returned for open and all pull requests issued to the
server.
* The default is defined as a system config variable.
* `None` is not allowed.
Keyword Arguments:
Expand Down Expand Up @@ -3193,13 +3207,11 @@ class (or subclasses).
* If positive, the WBEM server is to return no more than the
specified number of instances.
* If zero, the WBEM server is to return no instances. This may
be used by a client to leave the handling of any returned
instances to a loop of Pull operations.
* If `None`, this parameter is not passed to the WBEM server, and
causes the server-implemented default behaviour to be used.
:term:`DSP0200` defines that the server-implemented default is
to return zero instances.
* Zero is not allowed; it would mean that zero instances
are to be returned for open and all pull requests issued to the
server.
* The default is defined as a system config variable.
* `None` is not allowed.
Keyword Arguments:
Expand Down Expand Up @@ -3430,13 +3442,11 @@ def IterQueryInstances(self, FilterQueryLanguage, FilterQuery,
* If positive, the WBEM server is to return no more than the
specified number of instances.
* If zero, the WBEM server is to return no instances. This may
be used by a client to leave the handling of any returned
instances to a loop of Pull operations.
* If `None`, this parameter is not passed to the WBEM server, and
causes the server-implemented default behaviour to be used.
:term:`DSP0200` defines that the server-implemented default is
to return zero instances.
* Zero is not allowed; it would mean that zero instances
are to be returned for open and all pull requests issued to the
server.
* The default is defined as a system config variable.
* `None` is not allowed.
Keyword Arguments:
Expand Down Expand Up @@ -5266,8 +5276,8 @@ def PullInstancesWithPath(self, context, MaxObjectCount,
* If positive, the WBEM server is to return no more than the
specified number of instances.
* If zero, the WBEM server is to return no instances. This may
be used by a client to leave the handling of any returned
instances to a loop of Pull operations.
be used by a client to reset the interoperation timer
* None is not allowed for this operation.
Keyword Arguments:
Expand Down Expand Up @@ -5337,6 +5347,7 @@ def PullInstancesWithPath(self, context, MaxObjectCount,
**extra)

try:
_validatePullParams(MaxObjectCount, context)

namespace = context[1]

Expand All @@ -5362,7 +5373,7 @@ def PullInstancesWithPath(self, context, MaxObjectCount,
self.operation_recorder.record_staged()
return result_tuple

def PullInstancePaths(self, context, MaxObjectCount=None, **extra):
def PullInstancePaths(self, context, MaxObjectCount, **extra):
# pylint: disable=invalid-name

"""
Expand Down Expand Up @@ -5401,8 +5412,8 @@ def PullInstancePaths(self, context, MaxObjectCount=None, **extra):
* If positive, the WBEM server is to return no more than the
specified number of instances.
* If zero, the WBEM server is to return no instances. This may
be used by a client to leave the handling of any returned
instances to a loop of Pull operations.
be used by a client to reset the interoperation timer.
* None is not allowed for this operation.
Keyword Arguments:
Expand Down Expand Up @@ -5469,6 +5480,7 @@ def PullInstancePaths(self, context, MaxObjectCount=None, **extra):
**extra)

try:
_validatePullParams(MaxObjectCount, context)

namespace = context[1]

Expand All @@ -5494,7 +5506,7 @@ def PullInstancePaths(self, context, MaxObjectCount=None, **extra):
self.operation_recorder.record_staged()
return result_tuple

def PullInstances(self, context, MaxObjectCount=None, **extra):
def PullInstances(self, context, MaxObjectCount, **extra):
# pylint: disable=invalid-name
"""
Retrieve the next set of instances from an open enumeraton
Expand Down Expand Up @@ -5532,8 +5544,8 @@ def PullInstances(self, context, MaxObjectCount=None, **extra):
* If positive, the WBEM server is to return no more than the
specified number of instances.
* If zero, the WBEM server is to return no instances. This may
be used by a client to leave the handling of any returned
instances to a loop of Pull operations.
be used by a client to reset the interoperation timer.
* None is not allowed for this operation.
Keyword Arguments:
Expand Down Expand Up @@ -5597,6 +5609,7 @@ def PullInstances(self, context, MaxObjectCount=None, **extra):
**extra)

try:
_validatePullParams(MaxObjectCount, context)

namespace = context[1]

Expand Down
Loading

0 comments on commit 1145729

Please sign in to comment.