Under python3 not closing file handles or network resources correctly
results in warnings being shown to the end user. This change switches
the resource usage to properly close when we're done.
Change-Id: Iaf08f7d7b919b154797cf8f10663f349424cd6a2
Related-Bug: #1837393
https://review.opendev.org/673862 allows config_download
workflow to take deployment_options as a input, this patch
passes it to the workflow so ansible_python_interpreter
is set correctly in generated inventory and thus used
during ansible deployment.
Depends-On: https://review.opendev.org/#/c/673862/
Closes-Bug: #1838540
Change-Id: I993fc09fd571fb93d78ffdbecf1823e806f744f4
The code behind these options has been removed in tripleo-heat-templates
so we no longer need these cli options. Additionally we do not want
folks using them since they do nothing.
https://review.opendev.org/#/c/669951/
Change-Id: Ib1444f8b21d90a00dd1d775f5eac633c43f39741
Without properly mocking the deployment action, these tests are trying
to execute deployment code including temp file creation which can lead
to package build failures. This change mocks out the deployment take
action for the UpgradeRun so we're only testing the upgrade code
itself.
Change-Id: I3ac295d2e2f86fbb2120f9491d4103434b6ac3da
Closes-Bug: #1838506
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
This patch adds a new parameter called 'gathering_policy' (Defaults to
None) to the 'run_ansible_playbook' function. This parameter will
control the default policy of the Ansible fact gathering. Sets to None
by default, it will use the default policy for Ansible (ie. 'implicit').
Change-Id: I0668241a1675dd4e344cc24b6ff2cbb8f93b7a45
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
The validations execution will use now a static inventory file to speed
up things a bit. Note that this file will be removed after execution.
Change-Id: Ibdc3fc7ea9d3dec9531a2ce29ec8a1477c33c780
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
When using local connection, all the validations targeting the overcloud
nodes are failing. Let's use the connection mode from the Ansible
inventory.
Change-Id: I188604f7767b51a0f485bd79ff3497af56586b13
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
This patch adds a new parameter called 'plan' (Defaults to "overcloud")
to the 'run_ansible_playbook' function. It will allow to execute
Validations with Ansible in a different plan or stack that the default
one through the TripleO CLI. Note That it was already possible only
while using Mistral but not for Ansible.
This patch also brings:
- Change the default values of the 'tags' and 'skip_tags' arguments
to 'None' and fixes their non Pythonic tests.
- Add '--stack' alias to the '--plan' argument for 'validator run'
command.
Change-Id: I6f8f55963f3f5261ec1497b650e0ca509d31dd32
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
The oslo messaging host configuration does not actually use the endpoint
map so we need to be able to provide this information as part of the
output yaml file for use with a minion. This code grabs the ctlplane
ip out of the rolenetmap for the undercloud and uses it to construct the
oslo messaging node names value that is used when configuring the service.
Blueprint: undercloud-minion
Change-Id: I5dc103452f3e7484ea81df15d75b606d2c74859a
The default concurrency of 20 may be too high for small underclouds
(especially CI environments), so this change adds a --concurrency
argument so callers can control the maximum number of nodes
to introspect concurrently.
Depends-On: https://review.opendev.org/#/c/672389/
Change-Id: I9faee9ab133e34466a79aa1176a16106bda1f15d
Closes-Bug: #1836976
[1] provides the steps on how to setup multiple cells using tripleo.
This requires to extract deployment information from the overcloud
/control plane stack which then is used as input for the cell
deployment.
With this patch we provide a new tripleoclient functionality which
helps
to automate the export steps from [1]:
* Export the default cell EndpointMap
* Export the default cell HostsEntry
* Export AllNodesConfig and GlobalConfig information
* Export passwords
[1] https://docs.openstack.org/tripleo-docs/latest/install/advanced_deployment/deploy_cellv2.html#deploy-an-additional-nova-cell-v2
Depends-On: https://review.opendev.org/672415
Change-Id: Id7fdbf029a6dd1b45e9801c9cf8814a15a157ee0
The 'openstack tripleo validator list' subcommand can now get only the
available parameters for the validations using the new --parameters
argument.
```
$ openstack tripleo validator list \
--parameters \
[--validation-name <validation_id>[,<validation_id>,...] |
--group <group>[,<group>,...]]
```
Here is an output example:
```
Waiting for messages on queue 'tripleo' with no timeout.
{
"undercloud-cpu": {
"parameters": {
"min_undercloud_cpu_count": 8
}
},
"undercloud-ram": {
"parameters": {
"min_undercloud_ram_gb": 24
}
}
}
```
The --create-vars-file allow the operator to generate either a JSON or a
YAML file containing only the parameters of one or multiple validations.
This file will be available to pass as extra vars to the validations
execution.
```
$ openstack tripleo validator list \
--parameters \
--create-vars-file [json|yaml] /home/stack/myvars \
[--validation-name <validation_id>[,<validation_id>,...] |
--group <group>[,<group>,...]]
```
Change-Id: I6e2255c0d490ee8105f0757d02f5d8fba1d4fa20
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
This patch adds the ability to pass extra variables to the validations
execution through Mistral and 'ansible-playbook'.
By default, the CLI is running the validations through
'ansible-playbook', then the operator will have two possible ways to
process it;
Either passing a Dict with the new --extra-vars argument
```
$ openstack tripleo validator run \
--extra-vars '{"min_undercloud_ram_gb": 2}'
--validation-name undercloud-ram
```
or passing the absolute path of a JSON/YAML file using --extra-vars-file
argument.
```
$ cat /home/stack/vars.json
{
"volumes": [
{"min_size": 10, "mount": "/var/lib/docker"},
{"min_size": 3, "mount": "/var/lib/config-data"},
{"min_size": 3, "mount": "/var/log"},
{"min_size": 5, "mount": "/usr"},
{"min_size": 20, "mount": "/var"},
{"min_size": 25, "mount": "/"}
]
}
$ openstack tripleo validator run \
--extra-vars-file /home/stack/vars.json
--validation-name undercloud-disk-space
```
If the operator wants to use Mistral, she/he will just need to add the
--use-mistral argument to the command line in the previous
examples.
Note that Mistral will only support a valid JSON file as input.
Change-Id: Idff6bcebc041db483d64396249b040e6bdd778bd
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
This patch adds a new parameter called 'extra_vars (Defaults to None) to
the 'run_ansible_playbook' function. This parameter will set additional
variables to the 'ansible-playbook' command. It will accept either a
dict or the absolute path of a file (YAML or JSON format).
Change-Id: Ib25ee9593528ad680b14ca09c62addbbd0b773a3
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
All the available Ansible variables for each Validations are now
processed as parameters and not as metadata anymore.
Change-Id: I1151923f3f0de7acf505a0beda3b7488c8ed8dec
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
https://review.opendev.org/#/c/664568/ adds mistral actions for
generating overcloud clouds.yaml file. This patch enables the
same to call the above mistral action and reuse
The clouds_yaml.py script is also moved from tht to here in
order to reuse the script.
Added proper constants and method for creating clouds yaml
directory.
Added a mock_clouds_yaml.py function to mock the
tripleo-common.utils.clouds_yaml script in order
to integrate with Tripleo.
Depends-On: https://review.opendev.org/#/c/664568/
Change-Id: I243ec370f9de0f2a0e34163962f1a1f228c3a9a1
Signed-off-by: Chandan Kumar (raukadah) <chkumar@redhat.com>
Fixes an issue wich cause warnings such as the one below on the
console when using python3.
ResourceWarning : unclosed file <_io.TextIOWrapper name='FILENAME'
Closes-Bug: #1836379
Change-Id: I4a80a339b2cc0c3fca992cfc456581a91dbf2eef
This patch allows the operator to run all the validations belonging to
a group using ansible-playbook instead of Mistral.
Change-Id: I8c833819c88f1822bf605df0c997ab5d651e7620
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
This patch switch over Ansible to run validations by names by
default. The --use-mistral argument will have to be used in order to
execute them through Mistral.
Co-Authored-By: Gaël Chamoulaud <gchamoul@redhat.com>
Change-Id: Ia393f4d776ab2c09439e7772b5596ddbb47e0a5e
This patch adds a new parameter called 'log_path_dir' (Defaults to None)
to the 'run_ansible_playbook' function. The Ansible log file will be
created in the location of the playbook by default, otherwise in the given
directory path.
Change-Id: I7222a116974458b9149771cb44f7d5f7bc51bc79
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>