20 Commits

Author SHA1 Message Date
Jakob Meng
f73a0e385e Use true and false instead of yes and no for boolean values
Story: 2010586
Task: 47380
Change-Id: I1b88aa925d823d74b2d012153dfe26d35c93dfd5
2023-02-21 13:07:29 +01:00
Jakob Meng
19d1d41ee0 Bump minimum required openstacksdk release to 1.0.0
openstacksdk's first major release brings new features and bug fixes,
e.g. for Magnum clusters and cluster templates [1], [2], [3].

[1] https://review.opendev.org/c/openstack/openstacksdk/+/865267
[2] https://review.opendev.org/c/openstack/openstacksdk/+/871648
[3] https://review.opendev.org/c/openstack/openstacksdk/+/871987

Change-Id: Ic7aa998ac5fa5c05dbea188a4d3b76ea774ff797
2023-01-31 19:52:01 +01:00
Jakob Meng
1b38b7c500 Properly documented openstacksdk version requirements
With "extends_documentation_fragment: ['openstack.cloud.openstack']"
it is not necessary to list required Python libraries in section
'requirements' of DOCUMENTATION docstring in modules. Ansible will
merge requirements from doc fragments and DOCUMENTATION docstring
which previously resulted in duplicates such as in server module [0]:

* openstacksdk
* openstacksdk >= 0.36, < 0.99.0
* python >= 3.6

When removing the 'requirements' section from server module, then
Ansible will list openstacksdk once only:

* openstacksdk >= 0.36, < 0.99.0
* python >= 3.6

To see what documentation Ansible will produce for server module run:

  ansible-doc --type module openstack.cloud.server

[0] https://docs.ansible.com/ansible/latest/collections/openstack/\
    cloud/server_module.html

Change-Id: I727ed95ee480bb644b5a533f6a9526973677064c
2023-01-16 13:51:01 +01:00
Jakob Meng
cec58d7560 Bump minimum required openstacksdk release to 0.103.0
Latest release candidate 0.103.0 of openstacksdk's first major release
brings new features and bug fixes, e.g. for floating ips [1],
servers [2] and flavors [3].

[1] https://review.opendev.org/c/openstack/openstacksdk/+/850115
[2] https://review.opendev.org/c/openstack/openstacksdk/+/857987
[3] https://review.opendev.org/c/openstack/openstacksdk/+/864554

Change-Id: Ib96cbc0522fcb0d7c10a11c98172184f60b4407d
2022-11-30 10:54:40 +01:00
Jakob Meng
0ade33eb6f Bump minimum required openstacksdk release to 0.102.0
Latest release candidate 0.102.0 of openstacksdk's first major release
brings new features and bug fixes, e.g. for floating ips [1], [2].

[1] https://review.opendev.org/c/openstack/openstacksdk/+/859672
[2] 2535ba7a28

Change-Id: I009c8515e853baf4df3455fab19571f28e02ab46
2022-10-14 12:08:43 +02:00
Jakob Meng
57cc3e6aad Bump minimum required openstacksdk release to 0.101.0
Latest release candidate 0.101.0 of openstacksdk's first major release
brings new features and bug fixes, e.g. for floating ips [1], [2].

[1] https://review.opendev.org/c/openstack/openstacksdk/+/851976
[2] 0ded7ac398

Change-Id: I4f63e9edab19ba25918513b8c89fcd62913ae75a
2022-09-22 04:49:40 +00:00
Jakob Meng
ac401bb354 Refactored server and server_info modules
Allow to update server attributes such as its description.

Changed default value of server attribute 'security_groups' from
['default'] to [] because the latter is the default in
python-openstackclient [1] and the former behavior causes issues
with existing servers [2]: Previously, when no 'security_groups'
parameter was given, the server module would change existing
servers to use the default security group, dropping all other
security groups assigned to the server.
Our (undocumented) guideline when writing modules is to only
add or change what has been requested by the user and to stick to
defaults from openstacksdk and python-openstackclient whenever
possible. Since we have to break backward compatibility with the
next release anyway, we take this opportunity to clean up this odd
behavior. Now, when no security groups are given, then security
groups of an existing server will not be touched.
Closes story #2007893 [2].
Note, Nova will create a server in the default security group,
if the security_groups parameter is omitted.

Dropped 'openstack' field from server module's results. This
variable expanded to additional server information which might
be useful for Ansible inventories and was filled from
openstacksdk's get_openstack_vars() function [3]. Variables in
this function can make additional cloud queries to retrieve
additional data, so calling this function can be expensive [4].
Users can use *_info modules to retrieve this data on-demand.

Dropped 'availabity_zone' attribute from generic OpenStackModule
arguments and inserted it into server and volume modules because
it is relevant to those two modules only. This is completes what
was started years ago [5] and is possible now since we have
breaking changes anyway.

Switched attribute name 'userdata' with its alias 'user_data' to
match openstacksdk's attribute names which are used e.g. in module
results. The previous attribute name 'userdata' is now used as an
alias and 'user_data' is used as the attribute name to keep backward
compatibility.

Wait for server to get into 'ACTIVE' state when creating a server
and attribute 'wait' has been set to true.

Sorted argument specs and documentation of the server module and
marked attributes which are not updatable. Changed unstable bash
script example in server module documentation.

Renamed server's module attribute 'delete_fip' to 'delete_ips' to
match openstacksdk and clarify that it includes all floating ip
addresses of the server.

Renamed server_info's module attribute 'server' to 'name' and added
the former as an alias to be consistent with other *_info modules.

Added RETURN fields documentation for the module results of both
server and server_info modules.

Added description and examples of how to use the 'filters' attribute
of the server_info module. Closes story #2007873 [6].

Removed 'openstack_' prefix from module results because the prefix is
not consistently used across modules, is more to type without any
benefit and removal of the prefix allows us to signal to users that
their code for handling module results has to be updated. Many modules
have different return values with openstacksdk >= 0.99.0 because it
consistently uses resource proxies now.

Added assertions for module results to catch future changes in the
openstacksdk and our Ansible modules.

Added integration tests to check the update mechanism of the server
module.

Fixed indentation in integration tests.

Ensure proper creation and deletion of resources such as networks,
subnets and servers in integration tests of server_action module.

Renamed ci/roles/server/defaults/main.yaml to main.yml, removing the
'a' in the file extension to be consistent with other filenames.

Dropped deprecated function openstack_find_nova_addresses() and
incorporated its code directly into the server module because it
is not used anywhere else.

[1] e49ad1795b/openstackclient/compute/v2/server.py (L1070)
[2] https://storyboard.openstack.org/#!/story/2007893
[3] 9e9fc98795/openstack/cloud/_compute.py (L1772)
[4] 9e9fc98795/openstack/cloud/meta.py (L482)
[5] 9bf33e56dd
[6] https://storyboard.openstack.org/#!/story/2007873

Signed-off-by: Jakob Meng <code@jakobmeng.de>
Change-Id: I2f955519a7e8c782b1dab8f94f7a019ed384b81d
2022-07-28 21:56:30 +02:00
Jakob Meng
0b2b56765c Fixed Python shebang and UTF-8 coding in modules
Be consistent with Ansible docs [1], [2], [3].

[1] https://docs.ansible.com/ansible/latest/dev_guide/developing_modules_documenting.html
[2] https://docs.ansible.com/ansible-core/devel/dev_guide/testing/sanity/shebang.html
[3] b86a18bd27/test/lib/ansible_test/_util/controller/sanity/code-smell/shebang.py

Change-Id: Ia3976bb3fcca662cefa219edeef057bcb7143c01
2022-07-28 10:03:09 +02:00
Zuul
bae75b84bd Merge "Raise minimum OpenStack SDK version to 0.99.0 again" 2022-07-19 14:22:29 +00:00
Jakob Meng
eda2e301c3 Raise minimum OpenStack SDK version to 0.99.0 again
This reapplies commit 4bfa135b20caeb6d6c2717049059ac52fd08e0e1 [1]
which got reverted in commit 1b59c19a24c55aa236d80552dcbf70c9c7b5088e
[2] due to issues in how TripleO Quickstart installed the Ansible
OpenStack collection. TripleO Quickstart has now been fixed and
will install code from our stable/1.0.0 branch instead of master for
all RDO branches which have openstacksdk <0.99.0 [3][4].

[1] 4bfa135b20
[2] 1b59c19a24
[3] https://review.opendev.org/c/openstack/tripleo-ci/+/849500
[4] https://review.opendev.org/c/openstack/tripleo-quickstart/+/849620/

Change-Id: I918d776c1560f03a4a84df371feb013d47043aa0
2022-07-19 09:55:11 +00:00
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 4bfa135b20caeb6d6c2717049059ac52fd08e0e1 [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
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
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
e504d807de Fix docs-args mismatch in modules
Change-Id: I51105f11565c5ff33b04add36259c8703af11240
2020-12-08 12:06:42 +02:00
Monty Taylor
238387f2f8 Remove incorrect os_ prefix in documentation
The parameteres are project_domain_name and user_domain_name.

Change-Id: I509ae5d398ff8a93d3cbcd09edb21118a1ff03c3
2020-05-12 10:10:57 -05:00
Mark Chappell
400e9c4873 Move default availability_zone docs into doc_fragment
If availability_zone is defined in the module this will override the fragment

Change-Id: I4f6abcbfee89a53480134dc64ca06782c8e6d094
2020-03-16 10:32:20 +01:00
Monty Taylor
53affc3220 Test with and assert support for python3
Collections are new. openstacksdk as of now doesn't support python2.
We shouldn't pretend to support python2 either. If you're using
ansible new enough to use collections, you can use python3.

This release of openstacksdk only supports 3.6 and onwards, so
set that as our min.

Change-Id: I34d544ce48f25bffde8e6e0cf82cdf9a85e681c3
2020-03-03 09:28:43 -06: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