Commit Graph

779 Commits

Author SHA1 Message Date
Artem Goncharov
f51898bd2f Do not enforce optional params in network module
It is wrong to enforce values of optional networking parameters. In the
clouds where those optional extensions are not installed this leads to
failures. Instead only pass params down to SDK if user explicitly set
them.

Change-Id: I5660eb8a4a65dd365ae7ce8c09825bbed8d2fdde
2022-10-18 16:51:03 +02:00
Jakob Meng
7bad5cfd42 Refactored stack_info module and allow to filter by owner and project names
Allow to filter stacks by owner names and project names instead of
ids only, in order to be consistent with other *_info modules.

Renamed stack_info's module attributes 'owner_id' to 'owner' and
'project_id' to 'project' to account for the new filter by name
functionality. Added the *_id attributes as aliases to keep
backward compatibility.

Updated and extended DOCUMENTATION, EXAMPLES and RETURN docstrings.

The stack_info module will convert its return values into dictionaries
without computed (redundant) values. Thus dropping values such as
location is not required anymore.

Change-Id: I9cdfb44dd424f63c05943616cf5918ceb3a57b1f
2022-10-14 12:22:10 +02:00
Jakob Meng
34b0abb4ca Refactored floating_ip and floating_ip_info modules
Use service proxies from openstacksdk wherever reasonable in order to
reduce calls to OpenStack API.

Renamed floating_ip_info's attribute 'project_id' to 'project' to be
consistent with other attributes and added the former as an alias to
keep backward compatibility. The latter can now also be used to search
for floating ips by project names, not only project ids.

Sorted argument specs and documentation of both modules.

Reworked integration tests, e.g. replaced references to server's
'addresses' attribute with calls to our port_info and floating_ip_info
modules. Also reformatted tests and added assertion on return values.

Merged integration tests of floating_ip_info module into floating_ip
module, because the former does not create any floating ips and
assumes that they have been created earlier.

For Zuul CI job ansible-collections-openstack-functional-devstack-\
releases to pass, the minimum required openstacksdk release must be
0.102.0 because [1],[2],[3],[4] are available since that release
only.

[1] https://review.opendev.org/c/openstack/openstacksdk/+/851976
[2] 0ded7ac398
[3] https://review.opendev.org/c/openstack/openstacksdk/+/859672
[4] 2535ba7a28

Change-Id: I129f866e7ed8d5c0499c93e78ebbe2c424e09423
2022-10-14 12:09:28 +02: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
Rafael Castillo
ed36d82a0c Refactor server_volume to be compatible with openstacksdk>=0.99.0
Change-Id: Id636bc5de1acb59ad8587cd6c7181e022097cfe7
2022-10-10 10:19:09 -07:00
Jakob Meng
41299b9666 Refactored stack module and use stack's tag(s) attribute
Dropped stack status checks for CREATE_COMPLETE and UPDATE_\
COMPLETE and instead pass wait=True to openstacksdk's create_stack()
and update_stack() calls because those will call event_utils.\
poll_for_events() which garantees that stack has reached those
states when they return [1],[2].

Check for duplicate keys in parameters which already have been
defined by regular module attributes. Raise an error to warn
users that they tried to overwrite parameters which they already
specified with module attributes.

Renamed stack's module attribute 'tag' to 'tags' to match both
openstacksdk and OpenStack API and clarify that more than a
single tag can be specified. Added 'tag' as an alias to keep
backward compatibility.

Actually pass the 'tags' aka 'tag' attribute to stack create
and update functions of the openstacksdk which was lost in [3].
Added tags to integration tests.

Sorted argument specs and documentation of the stack module and
marked attributes which are not updatable.

Dropped condition from self.conn.delete_stack() because the latter
will only return False when a stack could not be found which we
already. self.conn.delete_stack() will raise an exception when
stack deletion fails.

Renamed ci integration tests from 'orchestration' to 'stack' in
order to match module name and adapted tags accordingly.

Fixed and enabled ci integration tests for stack and stack_info
modules.

Dropped 'stack_name' from module return values in RETURN
docstring and ci integration tests because openstacksdk not
return this attribute.

[1] 9b1c433352/openstack/cloud/_orchestration.py (L92)
[2] 9b1c433352/openstack/cloud/_orchestration.py (L148)
[3] af79857bfb

Change-Id: I4ace6012112bbcce9094353e27eb4066cf25f229
2022-10-07 19:08:28 +00:00
Jakob Meng
a660a35d86 Replaced expensive get_server() and fixed issues in server module
openstacksdk's get_server() [1] calls add_server_interfaces() [2]
which queries OpenStack APIs several times to get all ports and
floating ips attached to a server.

Now we call openstacksdk's compute.find_server() [3] and compute.\
get_server() [4] which result in two API calls, in order to fill
server['addresses'] attribute which we later use to get floating ip
addresses attached to the server.

Do an extra call to compute.get_server() in order to return a pristine
server resource, because openstacksdk's create_server() might call
meta.add_server_interfaces() which alters server attributes such as
server['addresses'] [5].

Fail if options 'auto_ip', 'floating_ips' or 'floating_ip_pools'
are specified but 'wait' is not set to true, because openstacksdk
will add floating ip addresses only if we wait until the server
has been created [6]. This conditional fail will help users to not
shoot their foot.

Marked floating ip support unstable in this module due to various
unresolved issues in openstacksdk's add_ips_to_server() function
such as [9] and [10].

For Zuul CI job ansible-collections-openstack-functional-devstack-\
releases to pass, the minimum required openstacksdk release must be
0.101.0 because [7],[8] are available since that release only.

[1] 3f81d0001d/openstack/cloud/_compute.py (L484)
[2] 3f81d0001d/openstack/cloud/meta.py (L439)
[3] 3f81d0001d/openstack/compute/v2/_proxy.py (L652)
[4] 3f81d0001d/openstack/compute/v2/_proxy.py (L666)
[5] 3f81d0001d/openstack/cloud/_compute.py (L942)
[6] 3f81d0001d/openstack/cloud/_compute.py (L945)
[7] https://review.opendev.org/c/openstack/openstacksdk/+/851976
[8] 0ded7ac398
[9] https://storyboard.openstack.org/#!/story/2010352
[10] https://storyboard.openstack.org/#!/story/2010153

Change-Id: I6a5663433b1b9529f99d5eced22a28c692a1d288
2022-10-06 21:30:15 +02:00
Rafael Castillo
f0cb7f6802 Update quota for 2.0.0
Add a test role to validate module functionality

Replace calls to the sdk cloud layer to use the proxy layer.

Update module parameters to use names matching the sdk. Keep aliases for
old values.

Remove _scrub_results, no longer necessary with proxy layer.

Move check mode outside of main flow to keep the module readable.

Refactor code to handle fields that should be ignored.

Simplify return value from _system_state_change_details.

Inline calls to fetch existing quotas.

Remove metaprogramming calls to cloud layer methods, as the proxy layer
doesn't have the same consistent API.

Remove handling for case where neutron throws exception when unsetting
quotas that aren't set. This is validated in the test role.

Ensure return values are dicts.

Replace exception handler with conditionals which allows us to drop the
dependency on keystoneauth1 library and is much more correct than
catching all exceptions and always printing the same error even on
unrelated exceptions.

Story: 2010099
Task: 45654

Change-Id: I5eda8e476a4e779382e6c63f5982504d5951501d
2022-10-06 12:04:06 +02:00
Jakob Meng
6ab3d76696 Ensure openstacksdk compatibility in inventory plugin
Story: 2010337
Task: 46470

Change-Id: Ieb624b76627b5127d7a6c4d95233bbd5c2f16182
(cherry picked from commit e8bba38e2e)
2022-09-30 08:33:39 +02:00
Jakob Meng
40d913d2a6 Dropped minimum OpenStack SDK version in inventory plugin
We require openstacksdk>=0.99.0 for this collection but we do not
specify versions in module requirements. We probably should do so,
but then consistently across all modules and plugins.

Change-Id: If3d8cd1491266e3332f478267fc41771f280b9a8
2022-09-30 08:30:57 +02:00
anbanerj
41f3007a80 Makes stack module compatible with new sdk version
Change-Id: Iec99be0f422f1fab9b17e581b7b47a7540de749c
2022-09-27 10:28:56 +02:00
Jakob Meng
b416a3e242 Force major version bump in pbr
Sem-Ver: api-break

Ref.: https://docs.openstack.org/pbr/latest/user/features.html#version

Change-Id: Id0d5e5b389b3d2c194ff46ce91c3fe2e98e03c73
2022-09-23 10:43:22 +02:00
Rafael Castillo
ebaa1ac357 Specifically build master in tripleo periodic job
Currently, our tripleo periodic jobs are failing, while our check jobs
are passing. This is because build-test-packages is not building the
tip of master version of the collections, instead using the version
built in rdo. This patch explicitly adds ansible-collection-openstack to
the change list so it always gets picked up by build-test-packages.

Change-Id: I6938c8373872daed8632429df42d20396980bc76
2022-09-22 14:11:41 +00: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
9f3f0837c8 Updated network module docs
The network module does support updates since Will's patch [1].

[1] https://review.opendev.org/c/openstack/ansible-collections-openstack/+/854170

Story: 2010024
Task: 45262
Change-Id: I9e4af2c6e685686e28e7f2ae56a615529a6d7b59
2022-09-21 20:09:01 +00:00
Zuul
8a80113d54 Merge "Update federation_mapping_info module to be compatible with new sdk" 2022-09-21 17:42:22 +00:00
Arx Cruz
ffa84bd705 Update address scope to use proxy
Updating address scope module to use proxy layer and new openstacksdk

Change-Id: I4763e22e7ad9174e23aa2030f63f7535006399a0
2022-09-21 15:47:13 +02:00
Arx Cruz
c0bc0b0796 Update federation_mapping_info module to be compatible with new sdk
Change-Id: I5dae772622eb47822c4c0e0681a1d344fa9ef16a
2022-09-21 14:29:23 +02:00
anbanerj
fb0fb529b7 Makes security_group_rule_info compatible with new sdk version
- Changed get_security_group_rule to find_security_group_rule as
  get_security_group_rule throws an exception if the rule is not
  found
- Updated docs
- Updated tests
- Renamed ethertype to ether_type to match openstacksdk's attribute
  names and added the former as an alias to keep backward compat
- Renamed rule to id to match openstacksdk's attribute names and
  added the former as an alias to keep backward compat

Change-Id: Ieb99f875c990e11623c81e482013d0ecb8e61055
2022-09-21 00:27:25 +00:00
Will Szumski
2d0656f072 Allow networks to be updated
Neutron will allow you to update certain properties of the network after
creation. This change modifies the ansible code to perform an update
call if it detects that any updatable properties have been changed. If
you attempt to change a property that cannot be updated, the module will
fail. This gives you confidence that the ansible configuration matches
the state of the network in OpenStack. If we did not fail in this way,
you might think you have updated the network, but in reality those
changes would be silently ignored. Prior to this change, the only way to
update properties of a network was to delete it and then recreate.

Story: 2010024
Task: 45262
Change-Id: I4af2b50f207f349b58c63e0a4e92816ada0847fd
2022-09-20 10:02:41 +00:00
Sagi Shnaidman
515cc66287 Use Python 3.10 for Ansible's devel branch
Use Python 3.10 on Ubuntu 22.04 LTS (Jammy Jellyfish)
for Ansible 2.14 branch, since it supports Python from 3.9 now.
https://docs.ansible.com/ansible/devel/roadmap/ROADMAP_2_14.html
Change-Id: Ib20feb82729fe0b641aafa9c8b92060b1d85f9c9
2022-09-09 05:40:08 +00:00
Jakob Meng
73827a3d57 Do not remove trailing spaces when reading public key in keypair module
Previously, openstack.cloud.keypair would remove trailing spaces after
reading a public key from a file. The openstack cli tool, python-\
openstackclient, does not do so, i.e. it does not use rstrip to remove
spaces at the end [1]. This breaks idempotency when using openstack
cli tool and our keypair module at the same time.

The rstrip code was introduced to keypair when our modules were still
part of ansible (non-core) in a completely unrelated change [2].

Now, keypair module does no longer alter the public key and instead
uploads it unchanged to OpenStack API.

[1] 7df94c9f82/openstackclient/compute/v2/keypair.py (L103)
[2] 341efbf7ae

Story: 2008574
Task: 41726
Change-Id: Ia09658467d98516ca1ea612e7301629b2f69d2d1
2022-09-07 10:38:40 +00:00
Sagi Shnaidman
f2bf56d984 Fix release job
include_vars works on the controller only, use loading facts
to get variables from galaxy.yml
Change-Id: Idf45354650dea93bd8bdbfa9fa2ba52abda93cc0
(cherry picked from commit 39bb4909ee)
2022-09-07 06:51:17 +00:00
Arx Cruz
6d8c965333 Move keypair module to proxy layer
Update keypair module to new openstacksdk

Change-Id: I8f29d983b176e83fbca1919be34a86fe4756aa5e
2022-09-07 00:13:57 +00:00
Travis Holton
81a81ad759 Add floating_ip_enabled flag to coe_cluster creation
* Pass option as true if present
* False if not present

Change-Id: I44eaa8ee99386fdbd5020b36711b13b17db29b7b
2022-08-28 14:19:55 +12:00
Jakob Meng
b99218c143 Deprecate special value 'auto' for attribute 'id' of compute_flavor
Across our modules we use the None values to mark default values for
module attributes. This is in line with openstacksdk's behaviour.

Change-Id: I5920aeeb8eef2ee1c2066a71a273ba52f02305c3
2022-08-22 14:10:11 +02:00
Jakob Meng
d47cf4333c Remove debug statement leftover
Change-Id: I0d3d749b2f5b3474028c83c582c4fd7d1f07687d
2022-08-16 17:06:19 +00:00
Arx Cruz
8563e2327c Update federation_idp to use proxy
Update federation_idp to use proxy layer

Change-Id: I89ed8526c15608a043cc98e0de50a1ef6f1c8020
2022-08-16 14:21:35 +00:00
Rafael Castillo
4df7a12ebf Update compute flavor module for 2.0.0
Switch sdk calls to use the proxy layer where sensible.

Ensure that returned resource objects are converted to dicts.

Removes undocumented id return value.

Rename flavorid to id. Keep flavorid as an alias for backward
compatibility.

Rename the test role from nova_flavor to compute_flavor to keep naming
consistent.

Fold tests from compute_flavor_info into the compute_flavor role.

Add additional tests to improve coverage.

Update return docs

Change-Id: I5419d1c02b9b50625beb3bff88c8e4a4f1c14667
2022-08-11 12:48:20 +00:00
Jakob Meng
0ec16fbecc Dropped extra interfaces_info attribute from routers_info module
routers_info's interfaces_info attribute is not provided by
openstacksdk, it is added to each router resource by the routers_info
module after retrieving the routers list. To get the required data
list_router_interfaces() [1] is being called for each router resource
which then retrieves all ports for each router. This requires extra
api calls which might be useless because we do not know whether the
user actually cares about the ports. For getting ports of a router
we have the openstack.cloud.ports module. So instead of proactively
retrieving the router ports we drop the interfaces_info attribute.

The interfaces_info attribute was introduced because retrieving
interfaces via openstacksdk and openstack.cloud modules was
complex in the past [2]. Nowadays, using openstack.cloud.ports
Ansible and Jinja2 filters retrieving ip addresses of a router
is straight forward. In case someone still needs the old
interfaces_info attribute, one can refer to the module example
to see how it could be reproduced. But in general, retrieving the
router interfaces is much easier as can be seen in the updated
integration tests.

[1] 3f81d0001d/openstack/cloud/_network.py (L1926)
[2] https://review.opendev.org/c/openstack/ansible-collections-openstack/+/703927/6/plugins/modules/os_routers_info.py

Change-Id: I7fbdf11d07c95421d3aee800bfeebb88ea829817
2022-08-11 08:37:10 +00:00
Rafael Castillo
5e7c29d97e Update identity_group for 2.0.0
Replace calls to the sdk cloud layer with proxy layer calls where
appropriate.

Ensure module return values are converted into dict.

General refactoring to bring module more in line with collection
conventions.

Expand tests to assert idempotency and presence of return values.

Rename test role to identity_group to match module name.

Change-Id: I06fe28f77431bb151d85c8d9cd924a1634d85d98
2022-08-10 12:05:44 +02:00
Jakob Meng
d0eb83e934 Refactored port and port_info modules
Define port's module attribute 'name' as a required attribute because
this parameter is used to find, update and delete ports. Technically,
a name is not required to create a port, but idempotency cannot be
implemented without an identifier to refer to a port. In this
collection we use resource names to find and identify resources. We
do not offer a dedicated id attribute in most modules.

Use port's module attribute 'network' when finding, creating,
updating or deleting ports if the user provided this attribute.
This allows to reduce ambiguity when equal names are used across
different networks.

Added 'description' parameter to port module.

Renamed port's module attributes 'vnic_type' to 'binding_vnic_type'
and 'admin_state_up' to 'is_admin_state_up' to match openstacksdk's
attribute names which are used e.g. in module results. Added aliases
for the old attribute names to keep backward compatibility.

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

Dropped default=None and required=False from argument_spec of port
module because those are the default in Ansible [1][2].

Dropped 'id' field from port module's results to be consistent across
other modules. Use 'port.id' instead.

Sorted argument specs and documentation of the port module and
marked attributes which are not updatable.

Updated RETURN fields documentation for the module results of both
port and port_info modules.

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

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

Dropped openstacksdk version check since we require a recent release
anyway.

Fixed indentation in integration tests.

Merged integration tests of port_info module into port module,
because the former does not create any ports and assumes that
ports have been created earlier.

[1] https://docs.ansible.com/ansible/latest/dev_guide/developing_modules_documenting.html
[2] 61af59c808/lib/ansible/module_utils/common/parameters.py (L489)

Signed-off-by: Jakob Meng <code@jakobmeng.de>
Change-Id: Iacca78649f8e01ae95649d8d462f5d0a1740405e
2022-08-08 19:05:19 +00:00
Arx Cruz
ce6193cd2f Update federation_idp_info module to use proxy layer
This patch update federation_idp_info to use proxy layer as well as add
the ansible role to test the module

Change-Id: I6b4544cca317f2d5fab4a9612b820872b87585f4
2022-08-08 11:59:58 +02:00
Jakob Meng
fdc67892e3 Refactored router module
Expanded and fixed module results docs.

Moved ext_ips_spec into the module class because global scope is not
necessary. Renamed it to external_fixed_ips_spec to explain its
purpose.

Sorted argument_spec and attribute docs by attribute name and fixed
indentations. Marked router attributes which cannot be updated.

Mark network attribute as required by enable_snat and
external_fixed_ips attributes. Fixed docstring of network attribute:
Module attribute interfaces does not require the network attribute,
its external_fixed_ips what requires network to be set.

Changed examples from deprecated ip to current ip_address attribute.

Dropped self.fail() calls and let openstacksdk handle missing networks,
subnets.. instead because less code means less code to maintain.

Limited line length to 80 chars to be consistent with other OpenStack
projects. Personally, I prefer a 120 chars limit but consistency is more
important.

Added explanation in code comment why we cannot update a router's name.

Moved upfront cleanup operations in router's integration tests to the
beginning of the role.

Assigned meaningful names to result variables
in router's ci role to easily identify which modules produced the
data.

Added tests for router ids, admin state and interfaces.

Change-Id: Icae77a43479fb4f0bae065d1c5d7942cb0f5fd6b
2022-08-03 06:16:42 +00:00
Rafael Castillo
d2eb98d048 Update baremetal_inspect to be compatible with new sdk
Refactors the module to be based off OpenstackModule.

Changes sdk calls to use the proxy layer where appropriate. The
inspection itself stays at the cloud layer to support waiting.

Make sure we convert returned resource objects to dict

Adds a barebones role to test the module. This won't run in CI, since
we don't have the ironic plugin configured in devstack.

Changes the return value of the module to be the entire node, instead of
just the properties that resulted from inspection. Return docs were
updated to reflect this.

Update module params to use `name` as the identifier for the node,
aliasing it to the previous supported values of `id` and `uuid`.

Use module kwargs to specify mutually exclusive params.

Stop catching exceptions and instead let them bubble up so ansible
handles them.

Change-Id: I2b07b58c8b068d7f18db9862fcecb4088328ac74
2022-08-02 10:10:06 +02:00
Jakob Meng
1bf22feb2d Fixed code violating Flake8 rule E275
assert [1] is a Python keyword hence Flake8 raised an error:
"E275 missing whitespace after keyword" [2].

[1] https://docs.python.org/3/reference/lexical_analysis.html#keywords
[2] https://www.flake8rules.com/rules/E275.html

Change-Id: I76bbe10b850c38a3fbb38c4a2f5ee17ca5b91b4e
2022-08-01 14:32:24 +02: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
Rafael Castillo
3fdbd56a58 Update router for 2.0.0
- Change sdk calls to use proxies
- Convert return values to
- Update module docs
- Change argspec to more closely match the new sdk (and therefore the
  API) without breaking backward compatibility

Change-Id: I0f9bc573fd0c69cab65bd808145d628732bb0830
2022-07-28 11:31:37 +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
Sagi Shnaidman
ccbbc319ce Don't use deprecated distutils from python 3.10
distutils is deprecated in 3.10: https://peps.python.org/pep-0632/
Ansible requires it to be replaced[1]

[1] https://github.com/ansible-community/community-topics/issues/96
https://github.com/ansible-collections/news-for-maintainers/issues/18

Change-Id: I2bae37f206319e8f9ace468f5b94f6be643b6a3c
2022-07-27 14:03:59 +00:00
Jakob Meng
0215e2a5d4 Dropped default module options
Removed default=None, type='str' and required=False from all module's
argument_specs with

sed -i \
    -e 's/default=None, //g' \
    -e 's/default=None,//g' \
    -e 's/default=None//g' \
    -e "s/type='str', //g" \
    -e "s/type='str',//g" \
    -e "s/type='str'//g" \
    -e 's/required=False, //g' \
    -e 's/required=False,//g' \
    -e 's/required=False//g' \
    plugins/modules/*.py plugins/module_utils/*.py

and manually cleaned the results because those options values are the
default in Ansible.

Ref.: https://docs.ansible.com/ansible/latest/dev_guide/developing_program_flow_modules.html#argument-spec

Change-Id: Icbc3bb84269d3b8205fac259300902ebdaf6a3ae
2022-07-27 12:39:44 +02:00
Jakob Meng
ceae5c1030 Use master branch of openstacksdk in Bifrost jobs
Bifrost downgrades openstacksdk to a release <0.99.0 [1], which is
incompatible to our master branch of the Ansible OpenStack
collection. By adding openstacksdk to Zuul variable job.required-\
projects [2], Bifrost will install openstacksdk from its master
branch, overwriting any existing (older) openstacksdk releases.

[1] 03ddd02656
[2] https://review.opendev.org/c/openstack/bifrost/+/849563/5/playbooks/test-bifrost.yaml

Change-Id: I46dadc70338bb45d459e8176cc26e67c20c1d4ae
2022-07-25 20:20:46 +02:00
Dmitry Tantsur
2d60a045a6 Remove deprecated stuff from baremetal_node
Change-Id: Ia9fbc5b136347145d1a7ddc2d874f014c06558ae
2022-07-22 14:02:37 +00:00
Jakob Meng
b87ae7dcce Dropped symbolic links and plugin routing for deprecated module names
With Ansible OpenStack collection 2.0.0 we break backward
compatibility to older releases, mainly due to breaking changes
coming with openstacksdk >=0.99.0. For example, results will change
for most Ansible modules in this collection.

We take this opportunity to drop the symbolic links with prefix
os_ in plugins/modules and the plugin routing in meta/runtime.yml.
This means users have to call modules of the Ansible OpenStack
collection using their FQCN (Fully Qualified Collection Name) such
as openstack.cloud.server. Short module names such as os_server
will now raise an Ansible error. This also decreases the likelihood
of incompatible Ansible code going undetected.

Symbolic links were introduced to keep our collection backward
compatible to user code which was written for old(er) Ansible releases
which did not have support for collections and where OpenStack modules
where named with a prefix os_ such as os_server which is nowadays
known and stored as openstack.cloud.server.

In Ansible aka ansible-base 2.10, a internal routing table
lib/ansible/config/ansible_builtin_runtime.yml [1] was introduced which
Ansible uses to resolve deprecated module names missing the FQCN (Fully
Qualified Collection Name). Additionally, collections can define their
own plugin routing table in meta/runtime.yml [2] which we did.

In ansible-base 2.10 and ansible-core 2.11 or later, if a user uses a
short module name and the collections keyword is not used, Ansible
will first look in the internal routing table, get an FQCN, and then
looks in the collection for that FQCN. If there is another routing
entry for that new name in that collection's meta/runtime.yml,
Ansible will continue with that redirect. If it does not find another
redirect, Ansible will look for the plugin itself, so it will not
find a redirect in the collection before looking at its internal
redirects. Except if the user uses a FQCN, then it looks directly in
that collection.

Ansible 2.9 and 2.8 do not have any notion of these redirects with a
plugin routing table, backward compatibility with deprecated os_*
module names is solely achieved with symbolic links. Ansible releases
older than 2.11 are EOL [3], so usage of os_* symlinks should reduce
soon.

[1] https://github.com/ansible/ansible/blob/devel/lib/ansible/config/ansible_builtin_runtime.yml
[2] https://github.com/openstack/ansible-collections-openstack/blob/master/meta/runtime.yml
[3] https://docs.ansible.com/ansible/devel/reference_appendices/release_and_maintenance.html

Change-Id: I28cc05c95419b72552899c926721eb87fb6f0868
2022-07-22 09:48:20 +00:00
Dmitry Tantsur
fd15087c4d Add a wait argument to baremetal_node
openstacksdk will start using cleaning in 1.0.0 [1], so we need to be
able to wait for it to finish.

[1] https://review.opendev.org/c/openstack/openstacksdk/+/849402

Change-Id: I9695b1a5acfa007ad474c9b5b07a4fdb4c1b1198
2022-07-21 06:47:47 +00:00
Arx Cruz
960e5df17f Update port info
Make it compatible with new openstack sdk 1.0.0

Change-Id: I911eecd31ee69dbde1da02a74e152746c1e3edfa
2022-07-20 06:46:33 +00: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 4bfa135b20 [1]
which got reverted in commit 1b59c19a24
[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
Jakob Meng
b250b76c33 Dropped CentOS8-based TripleO job
No RDO release for CentOS8 will get a OpenStackSDK 1.x.x release.

Change-Id: I728f0f282717c11a782be30859f999008f3fc8cb
2022-07-19 09:28:52 +02:00
Jakob Meng
fc2dda1d86 Refactored TripleO jobs, e.g. to use latest openstacksdk RPM
Build and install latest RPM for openstacksdk from its master branch
instead of using the (pinned) RPM from RDO. This is necessary because
openstacksdk in RDO is currently pinned to <0.99.0 for all RDO
releases. Variable artg_change_list is used to define what code is
being build from source. The RPM of the Ansible OpenStack collection
does not have build from source because TripleO Quickstart installs
the collection from job.required-projects [1]. The latter shadows the
RPM release which is installed later by TripleO because it has a
higher precedence in ansible.cfg [2][3].

Changed the job hierarchy to other base jobs tripleo-ci-centos-8-\
standalone-build and tripleo-ci-centos-9-standalone-build. This reduces
the number of variables we have to define. It is also cleaner since our
CentOS9 job is no longer based on the CentOS8 job which prevents
issues with job variant collections due to our branched repository.

Added more Ansible modules to files which trigger TripleO jobs,
because Ansible role os_tempest [4] requires those modules and is
called in TripleO jobs. Modules which have been added include:
* openstack.cloud.compute_flavor
* openstack.cloud.image
* openstack.cloud.network
* openstack.cloud.router
* openstack.cloud.subnet

Added tripleo-ci-centos-8-standalone-osa to experimental jobs so that we
can actually run this job on demand easily.

[1] cb1595223b/quickstart.sh (L123)
[2] cb1595223b/ansible.cfg (L19)
[3] cb1595223b/quickstart.sh (L595)
[4] https://opendev.org/openstack/openstack-ansible-os_tempest.git

Change-Id: Ibde318678a3e44fdc297a6f29761eb0c7d77cbc9
2022-07-18 15:27:12 +02:00