22 Commits

Author SHA1 Message Date
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
8c889f8eb3 Fixed check mode
Change-Id: I3a7a0b0567ac24fb9433352fdc99022bf366fc6a
2022-11-08 13:48:01 +01:00
Jakob Meng
902b2f8147 Refactored baremetal_node and baremetal_node_info modules
Added integration tests for both modules. They will not run in CI atm,
because we do not have Ironic enabled in our DevStack environment.

Sorted argument specs and documentation of both modules.

Refactored both modules to be subclasses of OpenStackModule class.

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

baremetal_node_info will no longer fetch port and portgroup details
because this requires extra api calls for each node. Users can use
the baremetal_port module to retrieve ports for each node on demand.

Refactored code for constructing node updates in baremetal_node module
which allowed us to drop the dependency on Python module jsonpatch.

Deprecated baremetal_node's skip_update_of_masked_password attribute.
Updating or even specificing passwords for nodes has not been
supported for a while now, rendering the attribute useless.

Renamed baremetal_node's module attributes 'chassis_uuid' to
'chassis_id', 'uuid' to 'id' as well as suboptions of
'properties' to match openstacksdk. Added the previous attribute
names as aliases to keep backward compatibility.
Marked nics attribute in baremetal_node as not updatable.

Changed baremetal_node module to return attribute 'node' only when
state is present. It will return no values (except Ansible's default
values) when state is absent. Previous return value 'uuid' can be
retrieved from node's dictionary entry 'id'.
The non-standard return value 'result' has been dropped because its
content can easily be reconstructed with Ansible's is changed check.
The non-standard return value 'changes' has been dropped because it
was only returned on updates, has no known uses and can easily be
reconstructed in Ansible by comparing the returned node dictionary
with a copy of a previous node dictionary.

Module baremetal_node_info will no longer fail when no node with a
matching id or name or mac could be found. Instead it will return
an empty list like other *_info modules.

baremetal_node_info's return attribute 'baremetal_nodes' has been
renamed to 'nodes' to be consistent with other modules. The former
name will keep to be available for now to keep backward
compatibility.

Both modules convert their return values into dictionaries without
computed (redundant) values. They do not drop values such as links
anymore though, because we do not withhold information from users.

Updated DOCUMENTATION, EXAMPLES and RETURN docstrings in both
modules.

Dropped deprecated ironic_url attribute from DOCUMENTATION docstring
in baremetal_info. Dropped wait attribute from DOCUMENTATION because
its docstring will be added via documentation fragment.

Kept timeout attribute in DOCUMENTATION and argument_spec because
it has a high(er) default value, to account for long provisioning
times, than what e.g. the generic doc fragment specifies.

Change-Id: If3044acf672295e9b61fa60d0969f47cd06dfdeb
2022-10-25 10:11:39 +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
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
Dmitry Tantsur
2d60a045a6 Remove deprecated stuff from baremetal_node
Change-Id: Ia9fbc5b136347145d1a7ddc2d874f014c06558ae
2022-07-22 14:02:37 +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
Sagi Shnaidman
0441403c42 Run ansible devel sanity tests on py38
And fix some module typos.
Disable voting for octavia jobs till investigation.
Change-Id: Ie4cb69aa2337b0f951ac194cf456e4515dbc24fb
2021-08-03 01:32:31 +03:00
Sagi Shnaidman
c329f65b41 Fix issues with newest ansible-test 2.11
Change-Id: Ifdf253ca01b0e19b55867d8ead03eaceb5b2d73a
2021-04-07 14:47:00 +03:00
Zuul
5c3750df2c Merge "ironic: stop putting meaningless values to properties" 2021-02-16 11:47:39 +00:00
Zuul
c7969aa052 Merge "ironic: deprecate sub-options of driver_info" 2021-02-15 23:20:05 +00:00
Dmitry Tantsur
0843990dee ironic: stop putting meaningless values to properties
None of the properties are required nowadays, putting made-up values
there brings more harm than good.

Change-Id: I35bda0ac2dc9c32acb94aaa4d28572af2cac85fa
2021-02-12 14:38:27 +01:00
Dmitry Tantsur
6d4d8d4b0c ironic: deprecate sub-options of driver_info
This structure does not reflect the actual ironic API and is mostly
meaningless nowadays. Just let people populate driver_info directly.

Change-Id: I04d168dc86e8c0115b7183b14499fe1812af7343
2021-01-09 16:31:47 +01:00
Zuul
a4e6d1b67c Merge "Add support for new features" 2021-01-09 13:02:13 +00:00
Tosin Farai
f6a5433503 Add support for new features
Story: 2008432
Task: 41385
Change-Id: I8449075b9a0b39bdc9de8fa94cf238e5e8554875
2021-01-05 01:00:08 +01:00
Sagi Shnaidman
e504d807de Fix docs-args mismatch in modules
Change-Id: I51105f11565c5ff33b04add36259c8703af11240
2020-12-08 12:06:42 +02:00
Dmitry Tantsur
8b98452cbb Refactor ironic authentication into a new module_utils module
This change merely moves the code to one location. The next logical
step would be to make IronicModule inherit the common ansible module.

Change-Id: Iec0ca1e33de6ebc36d7664941eafe1d77203d8f2
2020-10-26 11:05:31 +00:00
Dmitry Tantsur
8731fcc64b Do not require ironic_url if cloud or auth.endpoint is provided
The endpoint may be specified in clouds.yaml or via auth, do not
force ironic_url in either of these cases.

Finally, accept "none" as a valid no-auth plugin name.

Change-Id: I4d50b7c55727f022d79df85fb4a163fe3e5fca7b
2020-07-28 17:10:01 +02:00
Monty Taylor
a96d28dfbc Update author lines
We don't use github, so having @ mentions of specific humans is
not valuable. Also, we are a team and own the modules as a team,
so calling out individual authors is philosophically contrary.

We landed a patch upstream to special-case this author string.

Change-Id: I38b4e68f14bbba6e13e8a50e2b202874ab74e3bc
2020-06-23 21:50:43 +03:00
Sagi Shnaidman
c75ab0924a Fix ansible-devel sanity tests for deprecations
Change-Id: I02c3f2cb5a8bb4c891a8f0e36628925208251bf7
2020-06-11 12:55:43 +03:00
Sagi Shnaidman
572fe85894 Remove ANSIBLE_METADATA from all modules
It's not required for collections,
for more details:
https://github.com/ansible-collections/overview/issues/57
Change-Id: I954eef25bb9837c9282665ad5586dbe37f4f4424
2020-05-14 17:00:01 +03:00
Monty Taylor
e47c4671c7 Rename all of the modules
This is separate from the previous patch - it's just the results
of running the script so we can review the two a little independently.
We should probably squash them.

Change-Id: I838f15cf4a32455a5be20033c8ddc27db6ca15c0
2020-05-12 10:20:50 -05:00