Commit Graph

16 Commits

Author SHA1 Message Date
Gael Chamoulaud
aa8132b736 Processing available Ansible variables as 'parameters' not as 'metadata'
Before this patch, all the available Ansible variables for each
validations coming from tripleo-validations were considered as
'metadata' which should only contain the following informations:

```
vars:
  metadata:
    name: ...
    description: ...
    groups: ...
```

This patch clarifies this by classifying all the potential variables as
'parameters' instead of 'metadata'.

Change-Id: I7b65b73722ebe0462eb86265197b456e8c77ed13
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
2019-07-08 13:02:31 +02:00
Gael Chamoulaud
5692174259 Get all the available Ansible variables for each validations
All the Ansible variables in the validations playbooks must be at the
same level as the metadata and not part of them.

```
- hosts: myhost
  vars:
    metadata:
      name: Validation name
      description: What should this validation do...
      groups:
        - prep
        - pre-deployment
    variable1: "value1"
    variable2: "value2"
    ...
```

Change-Id: Ib3d9ea8d9f85ea194a16feacb530d50419d7e54a
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
2019-07-08 12:28:07 +02:00
Gael Chamoulaud
f3a93bffb8 Fix validations_inputs temporary file name
All the validations were failing when running through Mistral with a
`sudo` command not allowed issue [1] due to a typo in the file name.

This patch fixes the name of the temporary files containing potential
ansible variables.

[1] mistral : command not allowed ; TTY=unknown ; PWD=/ ; USER=root
 ; COMMAND=/usr/bin/chown -h validations: /tmp/validation_inputs_PoJRZa

Change-Id: I6699bbbab5cb15a8fd200c144a3d575e9f29ca37
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
2019-05-15 12:25:59 +02:00
Gael Chamoulaud
d0831dc4ce Fix chown command in write_inputs_file function
The tripleo-common sudoers file allows an owner change on the
validations identity file. The command is only allowed with the `-h`
option, but this option isn't used in the `write_inputs_file` python
code. This breaks validation runs started through Mistral.

This patch adds this option to the `chown` command. It also removes an
useless line in the sudoers file.

Change-Id: Idd3098cfa3aab5dd618645e54b922f90cd9ae13f
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
2019-04-26 15:51:28 +00:00
Gael Chamoulaud
cbc0bfdb44 Adding support for the new validation framework
* Uploads now the contents of tripleo-validations/playbooks directory
  instead of tripleo-validations/validations ones.
* Adds a new parameter to run-validation script to be able to properly
  export Ansible variables:
  - ANSIBLE_CALLBACK_PLUGINS
  - ANSIBLE_LOOKUP_PLUGINS
  - ANSIBLE_ROLES_PATH
  - ANSIBLE_LIBRARY

Change-Id: I43cf796b0147a9b2054d3ff7941274a7497a14d9
Implements: blueprint validation-framework
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
2019-04-17 10:21:28 +02:00
Gael Chamoulaud
5762772fdf Make validation inputs configurable via Mistral
The validations have certain values (e.g. the amount of RAM necessary
for the undercloud node) configurable, but these were not exposed
through Mistral.

This adds a new `--inputs` parameter to the `run-validation` script
which takes a path to a YAML or JSON file with the additional
inputs (i.e. Ansible extra-args) defined.

And the `run_validation` action now optionally takes an `inputs`
dictionary which gets passed to `run-validation`.

Closes-Bug: #1625547
Implements: blueprint validation-framework
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>

Change-Id: I8944cf7133d47869d26974fd123cd93c98425f17
Co-authored: Tomas Sedovic <tsedovic@redhat.com>
2019-04-01 10:43:11 +00:00
Alex Schultz
550537acf4 Handle swift interactions are strings as necessary
To properly handle the differences between python2/python3 we need to
ensure that when we interact with swift and are dealing with string data
that we handle the types correctly. This change adds a swift utils
helper to call to get the string data from an object out of swift. For
example our json and yaml files are all strings so if we try to use
something like json.dumps() from data we pull from swift, it errors
because we're given a bytes like object in python3.

Change-Id: I7996cc08cdd3bddf3f4ba0fb2e48f926f944c0dd
Related-Blueprint: python3-support
2019-03-01 15:45:56 -07:00
Ana Krivokapic
8f88e78778 Add support for custom validations
This patch introduces support for running custom validations by changing
the behavior of the validations actions ListValidationsAction,
ListGroupsAction and RunValidationAction.

Until now, these actions sourced validations from a directory on disk.
Now, these action are sourcing validations from the plan container
subdirectory (custom validations), or, if this is not available, from
the Swift container holding the default validations.

Change-Id: I9e9131b355312c53f12d154976d5d9cd706cc338
Implements: blueprint custom-validations
Depends-On: I338e139fa770ebb7bdcc1c0afb79eec062fada8b
2018-08-10 11:21:29 +02:00
Toure Dunnon
26fdf89e67 Fix chown command for tripleo validation.
This change will allow the current changes in the sudoers file to
execute correctly. The fix will match how sudo expects the workflow
call to be performed.

Change-Id: I5b790820bcec207ff7ceff1a23b3ed22858e5a52
2017-11-22 15:09:08 +00:00
Adriano Petrich
fbfe481ee4 move mistral base action dependency to mistral_lib
mistral_lib base TripleoAction has a context in the run method
signature. These changes remove the mistral.context and make use
of the one provide by the default executor

Change-Id: Ib1a5aa8d5735b05f5308dc943ac088b5eeeec253
2017-05-17 23:51:05 +01:00
Oliver Walsh
5f136811d6 Add MigrationSshKey to generated passwords
This reuses the existing password generation mistral action to generate an ssh
keypair to be used for nova cold migration

Paramiko is used to generate the ssh key, based on the existing approach in the
nova keypair api.

Also update validation ssh key generation to reuse the same method.

Change-Id: I9e7a1862911312ad942233ac8fc828f4e1be1dcf
2017-04-03 09:22:10 +01:00
Adriano Petrich
3f718ad23f Validate the plan name before running
By default the plan name is used on the creation of the node name
in the form of plan_name + role + index

Forcing the plan name to be only letters and numbers removes the
possibility of a failed deploy due to an invalid node name

I've included a pattern validator to verify that those names are valid
and a constant for node and plan name validation

Change-Id: I111d0ba43d810657aa0b76b6ea4afd5175be1d30
Closes-Bug: #1644587
2016-12-21 09:22:58 +00:00
Martin André
16cdf9cf36 Allow running validation against different plans
This commit adds support for selecting plan (overcloud) against which
to run validations, configurable with the `plan` variable in relevant
mistral actions.

The `run-validation` wrapper now accept the plan name as a second
argument and pass it to Ansible dynamic inventory script via
TRIPLEO_PLAN_NAME variable. The default plan remains `overcloud`.

Change-Id: Icebf91360f387d7f558c2b5a6a5a4decb5a89093
2016-08-29 13:56:49 +02:00
Martin André
d43f124804 Workflows to run validations
This commit adds a workflow to run ansible validations.

Validations can be run individually or by group, and the result is sent
over the specified zaqar queue.

Change-Id: Iba8b210c83e94eaa340d34e17ad2b0278ecc4e53
Depends-On: I807fed12e9a42a71c130f393370ff4152831c27b
2016-08-29 13:56:49 +02:00
Martin André
ceecdadbf4 Workflows to load validations
This commit adds workflow to list available validations and validation
groups.

Change-Id: I85fb6c1939e711887b2ee91c9cefa41a3da681a3
2016-08-29 13:56:49 +02:00
Martin André
c31ed3db3b Workflow to setup validations
The new tripleo.validations.v1.copy_ssh_keys workflow copies the
provided public key to the overcloud nodes in preparation for running
ansible validations.

When no public key exists, a new one will be generated and stored in
a dedicated mistral environment.

Change-Id: I93972b34186ac3aaf54fa6aebd14bf48b5247266
2016-08-25 16:19:49 +02:00