When calling the NodeManager get method with resource_id
equal to [], {}, (), None, "" or False the client returns a bad
data structure.
In order to be consistent with the API and the CLI the
resource_id is now validated before calling the API
and raises ValidationError in case of invalid value.
Change-Id: Idb2b424ab17e79da948595fb74df3ef9d81732c0
Closes-Bug: #1652142
This adds a new method base.Manager._get_as_dict() which
checks whether there is a resource first, before calling
Resource.to_dict(). Code was modified to call this new
method, instead of calling Resource.to_dict() directly.
This fixes the AttributeError that occurs if, for example, one
tries to get the list of driver passthru methods of the 'fake'
driver (via 'ironic driver-get-vendor-passthru-methods fake').
There are no methods, and without this change, an AttributeError
exception is raised. With this fix, an empty list is returned.
Change-Id: Ib6b691cd39ede9c5902b4df29023fd974b367a7d
Closes-Bug: #1626806
When creating a resource via CreateManager.create(),
an InvalidAttribute could be raised for invalid attributes
(attributes that are not needed to create the resource).
The raised exception had no message.
This changes the exception to include a list of all the
invalid attributes as well as indicate what the problem
is.
Change-Id: Iaea056ea6946a6f813f8081c26f62dcfe63d1bbd
without changing the API
This commit does refactoring regarding the base.Manager and the
specific managers that inherit from it (Chassis, Node, Port and
Driver).
The specific managers had a lot of duplicate code in methods like:
get, create, delete and update, they were literally equal, what does
not make sense once we already had the base.Manager inheritance to
avoid this type of problem.
This change moves the duplicate code to the parent (base.Manager) and
make the specific managers simpler by making the base.Manager more
useful regarding code reuse for these methods.
Change-Id: Ic77a86196d5bcd956f0a3ae517200824a4d70aa8
Closes-Bug: #1517631
This reverts commit 46b279bb36b2647bf04097fe271586fca76f5ed0.
The patch being reverted has broken the API compatibility. Until a fix
for this issue has been created, the patch should be reverted.
Change-Id: I1295c3e0d5ca228253874719befd7ed842d505fa
Closes-Bug: #1521429
This commit does refactoring regarding the base.Manager and the
specific managers that inherit from it (Chassis, Node, Port and
Driver).
The specific managers had a lot of duplicate code in methods like:
get, create and vendor_passthru, they were literally equal, what does
not make sense once we already had the base.Manager inheritance to
avoid this type of problem.
This change moves the duplicate code to the parent (base.Manager) and
make the specific managers simpler by making the base.Manager more
useful regarding code reuse for these methods.
Change-Id: I9acef9ecc815df61d7ddabe3fae9eccdafe2eeed
Closes-Bug: #1517631
According to the latest agreement in Oslo team, apiclient and
clituils will be removed from Oslo incubator. We should keep
the local copy by ourselfs:
1. rename openstack/common/apiclient to common/apiclient
2. Because Ironic only use base.py and exception.py, so delete others.
3. rename openstack/common/cliutils.py to common/clituils.py
4. Delete openstack/common/_i18n becuase we have common/i18n.py
5. Delete openstack folder because it is empty
6. Add related unit tests and add oslotest to test-requirements.
Change-Id: I9eecd0457e86e82e65db1d0bc9a4c5c0ed4bbf74
This is basically a revert of commit:
af741ec2236619880fa902d68aef4a6ae6cef534
It was decided that only files that need to have the line:
# -*- coding: utf-8 -*-
Should have the line[1] as a general principle
This patch removes the 'utf-8' coding line from files that consist
entirely of ASCII characters.
[1]
http://eavesdrop.openstack.org/meetings/ironic/2015/ironic.2015-04-20-17.00.html
Partial-bug: #1325193
Change-Id: I88c1c37f7b580aa805eae9d4a1e66d33302a325f
Current hacking version is incompatible with the one in the
global requirements. Match the hacking module version and made the
necessary changes to pass the tests.
Change-Id: Ie6b13a4ea112084d4c50dc27f97329dfad5777a1
the presence of a 'next' field is the indicator to continue pagination
until there're no more values to be returned.
On the CLI two new options were added to commands used to list resources:
* --marker: Optional, the UUID of an item, eg the last item from a
previous result set. Return the next result set.
* --limit: The maximum number of results to return per request, if:
1) limit > 0, the maximum number of items to return.
2) limit == 0, return the entire list of items.
3) limit param is NOT specified (None), the number of items
returned respect the maximum imposed by the Ironic API
(see Ironic's api.max_limit option).
Closes-Bug: #1314992
Change-Id: I77cc7a7df65c3d2a84144b12a001487ff6832045
While not strictly necessary for files containing only ASCII
characters, adding a line with "coding: utf-8" can guard against
future SyntaxError's in case someone inserts a Unicode literal.
This commit adds such lines to all .py files. The syntax used by this
commit works with Python (of course). It also works with Emacs, which
will recognize the special "-*-" marker and use the "coding" variable
to correctly decode the file, even in an environment where UTF-8 is
not the default file encoding.
Existing coding lines were normalized to match the new lines added.
Partial-bug: #1325193
Change-Id: I58bf93fea711fd25890356a397e594bd820c99e3
In the process of unification of the clients code we should
reuse common functionality from Oslo.
Related to blueprint common-client-library-2
Change-Id: Ide0bb6bcef845d5cf746d71eaed38d425403e17a