Commit Graph

17 Commits

Author SHA1 Message Date
Vladimir Hasko
19cd6262cf Add SDK logging option for openstack ansible collections.
The solution is based on implementation of logging option
in Open Telekom Cloud collections.

Change-Id: Ie8b309d2aaa8da57794888848fc5414de207e54f
2022-07-04 14:16:16 +00:00
Jakob Meng
1b59c19a24 Revert "Raise minimum OpenStack SDK version to 0.99.0"
This reverts commit 4bfa135b20 [1] because
it broke TripleO [2] and possibly other users which were using code from
master branch with incompatible SDK releases. We will reapply this
safety check later once dust has settled.

Ref.:
[1] 4bfa135b20
[2] https://bugs.launchpad.net/tripleo/+bug/1975646

Change-Id: I637f1b7c1b792adf6d3d17a27ccb42179f56a83b
2022-05-25 08:34:29 +02:00
Jakob Meng
4bfa135b20 Raise minimum OpenStack SDK version to 0.99.0
Alongside OpenStack SDK 1.0.0 we will release a new collection version
2.0.0 which is compatible to OpenStack SDK 1.x.x series only. Code in
branch stable/1.0.0 will remain compatible to OpenStack SDK 0.x.x
series only. Release candidates for the first major release of
OpenStackSDK 1.x.x will be numbered using 0.99.x versions.

At Ansible OpenStack modules PTG on 2022-04-07 it was decided to raise
an error if one is using a incompatible releases of the OpenStack SDK
with our collection. We decided against showing warnings only because
they can be missed easily and functionality  will be broken but
probably hardly detectable when using the wrong SDK.

This patch bumps the minimum required SDK versions to 0.99.0, so that
an error will be raised when users try to use our collection with an
incompatible SDK release, e.g. use code from our master branch with
a OpenStack SDK 0.x.x release.

Change-Id: I3974deabc516379745794806886352279dc4f4a7
2022-05-24 14:36:19 +02:00
Jakob Meng
bc6622e0e7 Added support for specifying a maximum version of the OpenStack SDK
Alongside OpenStack SDK 1.0.0 we will release a new collection version
2.0.0 which is compatible to OpenStack SDK 1.x.x series only. Code in
branch stable/1.0.0 will remain compatible to OpenStack SDK 0.x.x
series only.

At Ansible OpenStack modules PTG on 2022-04-07 it was decided to raise
an error if one is using a incompatible releases of the OpenStack SDK
with our collection. We decided against showing warnings only because
they can be missed easily and functionality  will be broken but
probably hardly detectable when using the wrong SDK.

This patch implements the code to raise errors when users are trying
to use our collection with an incompatible SDK release, e.g. use code
from our stable/1.0.0 branch with a OpenStack SDK 1.x.x release.

It does not yet change the minimum and maximum required SDK versions
because OpenStack SDK 1.0.0 has not yet been released to PyPI and
SDK's master branch still does not return a 1.x.x version number.

Change-Id: I1052d21cf8f108dbc99619cd4c4072488645b855
2022-04-27 06:45:30 +00:00
Jakob Meng
5a43bdb873 Follow up to bump of minimum required OpenStack SDK release to SDK 0.36.0 (Train)
Commit 879270aa47 [1] bumped the required minimum SDK release
but missed to update two locations in code and docs.

Ref.:
[1] 879270aa47

Change-Id: I725a26b07484619f6f2c460e974821f81d60b153
2022-04-22 12:09:26 +02:00
Daniel Speichert
4292a00f75 Added missing warn() used in cloud.openstack.quota
Change-Id: Ic7ba09cb464049a9ce0db4bafdba30a67b4c8b86
2021-09-15 14:38:30 -04:00
Sagi Shnaidman
eabe945194 Add check_mode attribute to OpenstackModule
Change-Id: I4a779113f7bf293b5f059d662a1a562d4192e537
2021-06-14 14:04:47 +03:00
Georgina Shippey
329a5ef50d Update checks for validate_certs in openstack_cloud_from_module
Change I51105f11565c5ff33b04add36259c8703af11240 moved validate_certs default from None to False.
This causes checks to fail in openstack_cloud_from_module as validate_certs is never None anymore.

This patch changes reverts the default back to None, and reflects this in the documentation.

Task: 41776
Story: 2008600
Change-Id: Ic79510f863cf3a39c3f5c6d99f61d335f92f9388
2021-06-01 17:22:37 +01:00
Sagi Shnaidman
c329f65b41 Fix issues with newest ansible-test 2.11
Change-Id: Ifdf253ca01b0e19b55867d8ead03eaceb5b2d73a
2021-04-07 14:47:00 +03:00
Sagi Shnaidman
e504d807de Fix docs-args mismatch in modules
Change-Id: I51105f11565c5ff33b04add36259c8703af11240
2020-12-08 12:06:42 +02:00
Mark Chappell
8ca8df1a84 OpenStackModule: Support defining a minimum version of the SDK
While it's currently possible to set min_ver and max_ver for specific
parameter, there are times when the whole module needs to specify a
minimum version:

- When the object isn't supported at all prior to a version
- When major features are missing from the SDK prior to a version

Change-Id: I94bbff7c54621e8a4786ebc7eb030103255dcb17
2020-10-19 13:55:30 +02:00
Sagi Shnaidman
03fadf3b43 Fix non existing attribuites in SDK exception
SDK exception may not have extra_data, details or
response attributes. Print None in this case.

Change-Id: Ic4073c28a4e4afb8ca5d2b72c4ea8582da244af1
2020-08-11 14:17:36 +03:00
Artem Goncharov
32ef77d9fd Add more useful information from exception
When the module faces API exception we can give much more useful
information to the user. Let us do this for the modules inheriting from
the base class, since all modules should do this at some point in time

Change-Id: I5f1ef01765829900334aa2ecae5dab3ba96f1a49
2020-06-23 18:43:09 +00:00
Sagi Shnaidman
f3610ad0e1 Redesign OpenstackModule class
don't inherit OpenstackModule class from AnsibleModule class to
prevent occasional overriding Ansible methods or vars and failing
module.

Change-Id: Ic34fff0c938eb87cc0d2c5e98fbafed64bf349f6
2020-06-04 13:49:48 +03:00
Sagi Shnaidman
347347b46e Fix ansible sanity linter tests
Change-Id: I2d08fdc77d930378be515da697c1cf975dd8b4d2
2020-04-02 13:20:01 +02:00
Sagi Shnaidman
ae0303d482 Make an OpenStackModule base class
In module_utils we have a bunch of factory functions that we expect
people to use in a certain combination to build a module, then we
pass around a reference to the SDK and to the connection we created.
That's largely just due to how this stuff grew organically.

Instead, create a base class to be used in the modules. For now it
allows us to clean things up a bit. But as a follow on - it should
maybe help us put in things like richer logging collection which
would otherwise need to be done with helper methods and whatnot.

Change-Id: I487e79fe18c0b9a75df7dacd224ab40ed7f4e1ab
2020-02-17 08:50:17 +00:00
Sagi Shnaidman
6ac08e7f0e Migrate openstack modules as a collection
Migrate accordin to Ansible guidelines [1[]] and tool
migrate.py [2]
Also fixed ALL ansible-test sanity issues

Add pep8 and linter job with runs ansible-test sanity test.

[1] https://etherpad.openstack.org/p/openstack-ansible-modules
[2] https://github.com/ansible-community/collection_migration

Change-Id: Ib2b1c8f23aacfca95304132bfe5c4cdedbea0520
2020-01-17 14:07:24 +00:00