Migrate linting to pre-commit

Follows the same linting configuration that was implemented first in
tripleo-quickstart-extras which makes used of pre-commit tool for
managing all linters.

This also avoids problems where a new linter release may break our
gates because pre-commit always pins versions.

Removes ansible from requirements.txt as it needs to be listed only
in ansible-requirements.txt

Change-Id: Ia229d3d58763d743bd19ad9099d7907561f3c77f
Depends-On: https://review.openstack.org/#/c/626000/
This commit is contained in:
Sorin Sbarnea 2018-12-18 20:00:53 +00:00 committed by Sergii Golovatiuk
parent 711a673c8f
commit 8ac74a8177
51 changed files with 319 additions and 274 deletions

15
.ansible-lint Normal file
View File

@ -0,0 +1,15 @@
parseable: true
rulesdir:
- ./ci-scripts/ansible_rules/
quiet: false
skip_list:
- ANSIBLE0006 # Using command rather than module we have a few use cases
# where we need to use curl and rsync
- ANSIBLE0007 # Using command rather than an argument to e.g file
# we have a lot of 'rm' command and we should use file module instead
- ANSIBLE0010 # Package installs should not use latest.
# Sometimes we need to update some packages.
- ANSIBLE0013 # Use Shell only when shell functionality is required
- ANSIBLE0016 # Tasks that run when changed should likely be handlers
# this requires refactoring roles, skipping for now
verbosity: 1

41
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,41 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.0.0
hooks:
- id: trailing-whitespace
- id: mixed-line-ending
- id: check-byte-order-marker
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: debug-statements
- id: flake8
additional_dependencies:
- hacking<1.2.0,>=1.1.0
- id: check-yaml
files: .*\.(yaml|yml)$
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.13.0
hooks:
- id: yamllint
files: \.(yaml|yml)$
types: [file, yaml]
entry: yamllint --strict -f parsable
- repo: https://github.com/ansible/ansible-lint
rev: v4.0.0
hooks:
- id: ansible-lint
files: \.(yaml|yml)$
entry: ansible-lint --force-color -v
- repo: https://github.com/openstack-dev/bashate.git
rev: 0.6.0
hooks:
- id: bashate
entry: bashate --error . --verbose --ignore=E006,E040
# Run bashate check for all bash scripts
# Ignores the following rules:
# E006: Line longer than 79 columns (as many scripts use jinja
# templating, this is very difficult)
# E040: Syntax error determined using `bash -n` (as many scripts
# use jinja templating, this will often fail and the syntax
# error will be discovered in execution anyway)

6
.yamllint Normal file
View File

@ -0,0 +1,6 @@
---
extends: default
rules:
line-length:
max: 180

View File

@ -134,7 +134,7 @@ An example playbook is provided in tests/test.yml:
- hosts: undercloud
gather_facts: true
become: yes
become: true
become_method: sudo
become_user: stack
roles:
@ -153,7 +153,7 @@ scripts using this example playbook (duplicate from
---
- hosts: undercloud
gather_facts: true
become: yes
become: true
become_method: sudo
become_user: stack
roles:

View File

@ -1,15 +0,0 @@
#!/bin/bash
# ANSIBLE0006: Using command rather than module
# we have a few use cases where we need to use curl and rsync
# ANSIBLE0007: Using command rather than an argument to e.g file
# we have a lot of 'rm' command and we should use file module instead
# ANSIBLE0010: Package installs should not use latest.
# Sometimes we need to update some packages.
# ANSIBLE0012: Commands should not change things if nothing needs doing
# ANSIBLE0013: Use Shell only when shell functionality is required
# ANSIBLE0016: Tasks that run when changed should likely be handlers
# this requires refactoring roles, skipping for now
SKIPLIST="ANSIBLE0006,ANSIBLE0007,ANSIBLE0010,ANSIBLE0012,ANSIBLE0013,ANSIBLE0016"
ansible-lint -vvv -x $SKIPLIST ./ -R -r ./ci-scripts/ansible_rules

View File

@ -43,7 +43,7 @@ use_oooq: false
# Running in tripleo ci
tripleo_ci: false
#rc files:
# rc files:
undercloud_rc: "{{ working_dir }}/stackrc"
overcloud_rc: "{{ working_dir }}/{{ overcloud_stack_name }}rc"
@ -65,7 +65,7 @@ workload_swap: 512
# note that both UC upgrade and update use the same template
undercloud_upgrade_template: undercloud_upgrade.sh.j2
undercloud_update_template: undercloud_upgrade.sh.j2
undercloud_update_template: undercloud_upgrade.sh.j2
overcloud_upgrade_prepare_template: overcloud_upgrade_prepare.sh.j2
overcloud_upgrade_run_template: overcloud_upgrade_run.sh.j2
overcloud_upgrade_converge_template: overcloud_upgrade_converge.sh.j2
@ -223,7 +223,7 @@ overcloud_update_multibooks: false
overcloud_upgrade_playbooks: ['upgrade_steps_playbook.yaml', 'deploy_steps_playbook.yaml', 'post_upgrade_steps_playbook.yaml']
# Ansible playbooks executed during "overcloud update run"
overcloud_update_playbooks: ['update_steps_playbook.yaml', 'deploy_steps_playbook.yaml' ]
overcloud_update_playbooks: ['update_steps_playbook.yaml', 'deploy_steps_playbook.yaml']
# Post upgrade/update nova actions tests
nova_actions_check: false

View File

@ -3,7 +3,7 @@
- hosts: undercloud
gather_facts: true
become: yes
become: true
become_method: sudo
become_user: stack
@ -11,67 +11,67 @@
- name: Set upgrade workload launch
set_fact:
workload_launch: true
workload_launch: true
when: install.upgrade.workload
- name: Set upgrade workload image
set_fact:
workload_image_url: "{{ install.upgrade.workloadimage }}"
workload_image_url: "{{ install.upgrade.workloadimage }}"
when: install.upgrade.workloadimage
- name: Set upgrade workload memory
set_fact:
workload_memory: "{{ install.upgrade.workloadmemory }}"
workload_memory: "{{ install.upgrade.workloadmemory }}"
- name: Set upgrade workload user
set_fact:
workload_user: "{{ install.upgrade.workloaduser }}"
workload_user: "{{ install.upgrade.workloaduser }}"
- name: Set upgrade workload disk size
set_fact:
workload_disk: "{{ install.upgrade.workloaddisk }}"
workload_disk: "{{ install.upgrade.workloaddisk }}"
- name: Set upgrade workload vcpus
set_fact:
workload_vcpu: "{{ install.upgrade.workloadvcpu }}"
workload_vcpu: "{{ install.upgrade.workloadvcpu }}"
- name: Set upgrade workload swap
set_fact:
workload_swap: "{{ install.upgrade.workloadswap }}"
workload_swap: "{{ install.upgrade.workloadswap }}"
- name: Set undercloud upgrade
set_fact:
undercloud_upgrade: true
undercloud_upgrade: true
when: install.undercloud.upgrade
- name: Set undercloud reboot
set_fact:
undercloud_reboot: true
undercloud_reboot: true
when: install.undercloud.reboot
- name: Set overcloud upgrade
set_fact:
overcloud_upgrade: true
overcloud_upgrade: true
when: install.overcloud.upgrade
- name: Set upgrade workarounds
set_fact:
upgrade_workarounds: true
upgrade_workarounds: true
when: install.upgrade.workarounds
- name: Set upstream container images
set_fact:
upstream_container_images: false
upstream_container_images: false
when: not install.upstream.container.images
- name: Set use docker local registry
set_fact:
use_local_docker_registry: false
use_local_docker_registry: false
when: not install.upgrade.docker.local.registry
- name: Set docker registry url
set_fact:
docker_registry_url: "{{ install.upgrade.docker.registry.url }}"
docker_registry_url: "{{ install.upgrade.docker.registry.url }}"
- name: Set undercloud update
set_fact:
@ -85,110 +85,110 @@
- name: Set updates workarounds
set_fact:
updates_workarounds: true
updates_workarounds: true
when: install.updates.workarounds
- name: Set upgrade floating ip check
set_fact:
l3_agent_connectivity_check: true
l3_agent_connectivity_check: true
when: install.upgrade.floatingip.check
- name: Set upgrade compute host evacuate
set_fact:
compute_evacuate: true
compute_evacuate: true
when: install.upgrade.compute.evacuate
- name: Set deployment-files base
set_fact:
container_registry_file: "{{ install.deployment.files | basename }}/docker-images.yaml"
container_registry_file: "{{ install.deployment.files | basename }}/docker-images.yaml"
when: install.deployment.files
- name: Set upgrade controller reboot
set_fact:
controller_reboot: true
controller_reboot: true
when: install.upgrade.controller.reboot
- name: Set upgrade controller post
set_fact:
controller_upgrade_post: true
controller_upgrade_post: true
when: install.upgrade.controller.post
- name: Set upgrade force reboot
set_fact:
force_reboot: true
force_reboot: true
when: install.upgrade.reboot.force
- name: Set upgrade remove packages
set_fact:
upgrade_remove_rpm: true
upgrade_remove_rpm: true
when: install.upgrade.remove.rpm
- name: Set upgrade HCI
set_fact:
upgrade_hci: true
upgrade_hci: true
when: install.upgrade.hci
- name: Set overcloud credentials file
set_fact:
overcloud_rc: "{{ working_dir }}/{{ install.overcloud.stack }}rc"
overcloud_rc: "{{ working_dir }}/{{ install.overcloud.stack }}rc"
- name: Set overcloud stack name
set_fact:
overcloud_stack_name: "{{ install.overcloud.stack }}"
overcloud_stack_name: "{{ install.overcloud.stack }}"
- name: Set undercloud FFU upgrade
set_fact:
ffu_undercloud_upgrade: true
ffu_undercloud_upgrade: true
when: install.undercloud.ffu.upgrade
- name: Set undercloud FFU upgrade releases
set_fact:
ffu_undercloud_releases: "{{ install.undercloud.ffu.releases }}"
ffu_undercloud_releases: "{{ install.undercloud.ffu.releases }}"
- name: Set undercloud FFU upgrade repo
set_fact:
ffu_undercloud_repo_type: "{{ install.undercloud.ffu.repo }}"
ffu_undercloud_repo_type: "{{ install.undercloud.ffu.repo }}"
- name: Set FFU upgrade workarounds
set_fact:
ffu_upgrade_workarounds: true
ffu_upgrade_workarounds: true
when: install.upgrade.ffu.workarounds
- name: Set overcloud FFU upgrade
set_fact:
ffu_overcloud_upgrade: true
ffu_overcloud_upgrade: true
when: install.overcloud.ffu.upgrade
- name: Set overcloud FFU upgrade releases
set_fact:
ffu_overcloud_releases: "{{ install.overcloud.ffu.releases }}"
ffu_overcloud_releases: "{{ install.overcloud.ffu.releases }}"
- name: Set overcloud FFU upgrade repo
set_fact:
ffu_overcloud_repo_type: "{{ install.overcloud.ffu.repo }}"
ffu_overcloud_repo_type: "{{ install.overcloud.ffu.repo }}"
- name: Set overcloud FFU bulk
set_fact:
ffu_bulk: false
ffu_bulk: false
when: not install.overcloud.ffu.bulk
- name: Set overcloud FFU compute rolling
set_fact:
ffu_computes_rolling: true
ffu_computes_rolling: true
when: install.overcloud.ffu.compute.rolling
- name: Set overcloud ssh user name
set_fact:
overcloud_ssh_user: "{{ install.overcloud.ssh.user }}"
overcloud_ssh_user: "{{ install.overcloud.ssh.user }}"
- name: Set upgrade l3 agent failover check
set_fact:
l3_agent_failover_check: true
l3_agent_failover_check: true
when: install.upgrade.l3agent.failover.check
- name: Set upgrade nova_actions_check
set_fact:
nova_actions_check: true
nova_actions_check: true
when: install.upgrade.nova.actions.check
roles:
- tripleo-upgrade

View File

@ -1,3 +1,4 @@
---
galaxy_info:
author: your name
description: your description
@ -24,15 +25,15 @@ galaxy_info:
# this branch. If travis integration is cofigured, only notification for this
# branch will be accepted. Otherwise, in all cases, the repo's default branch
# (usually master) will be used.
#github_branch:
# github_branch:
#
# Below are all platforms currently available. Just uncomment
# the ones that apply to your role. If you don't see your
# platform on this list, let us know and we'll get it added!
#
#platforms:
#- name: OpenBSD
# platforms:
# - name: OpenBSD
# versions:
# - all
# - 5.6
@ -41,7 +42,7 @@ galaxy_info:
# - 5.9
# - 6.0
# - 6.1
#- name: Fedora
# - name: Fedora
# versions:
# - all
# - 16
@ -54,13 +55,13 @@ galaxy_info:
# - 23
# - 24
# - 25
#- name: DellOS
# - name: DellOS
# versions:
# - all
# - 10
# - 6
# - 9
#- name: MacOSX
# - name: MacOSX
# versions:
# - all
# - 10.10
@ -69,46 +70,46 @@ galaxy_info:
# - 10.7
# - 10.8
# - 10.9
#- name: Synology
# - name: Synology
# versions:
# - all
# - any
#- name: Junos
# - name: Junos
# versions:
# - all
# - any
#- name: GenericBSD
# - name: GenericBSD
# versions:
# - all
# - any
#- name: Void Linux
# - name: Void Linux
# versions:
# - all
# - any
#- name: GenericLinux
# - name: GenericLinux
# versions:
# - all
# - any
#- name: NXOS
# - name: NXOS
# versions:
# - all
# - any
#- name: IOS
# - name: IOS
# versions:
# - all
# - any
#- name: Amazon
# - name: Amazon
# versions:
# - all
# - 2013.03
# - 2013.09
# - 2016.03
# - 2016.09
#- name: ArchLinux
# - name: ArchLinux
# versions:
# - all
# - any
#- name: FreeBSD
# - name: FreeBSD
# versions:
# - all
# - 10.0
@ -126,7 +127,7 @@ galaxy_info:
# - 9.1
# - 9.2
# - 9.3
#- name: Ubuntu
# - name: Ubuntu
# versions:
# - all
# - lucid
@ -144,7 +145,7 @@ galaxy_info:
# - xenial
# - yakkety
# - zesty
#- name: Debian
# - name: Debian
# versions:
# - all
# - etch
@ -154,25 +155,25 @@ galaxy_info:
# - squeeze
# - stretch
# - wheezy
#- name: Alpine
# - name: Alpine
# versions:
# - all
# - any
#- name: EL
# - name: EL
# versions:
# - all
# - 5
# - 6
# - 7
#- name: Windows
# - name: Windows
# versions:
# - all
# - 2012R2
#- name: SmartOS
# - name: SmartOS
# versions:
# - all
# - any
#- name: opensuse
# - name: opensuse
# versions:
# - all
# - 12.1
@ -180,7 +181,7 @@ galaxy_info:
# - 12.3
# - 13.1
# - 13.2
#- name: SLES
# - name: SLES
# versions:
# - all
# - 10SP3
@ -192,11 +193,11 @@ galaxy_info:
# - 11SP4
# - 12
# - 12SP1
#- name: GenericUNIX
# - name: GenericUNIX
# versions:
# - all
# - any
#- name: Solaris
# - name: Solaris
# versions:
# - all
# - 10
@ -204,21 +205,21 @@ galaxy_info:
# - 11.1
# - 11.2
# - 11.3
#- name: eos
# - name: eos
# versions:
# - all
# - Any
galaxy_tags: []
# List tags for your role here, one per line. A tag is
# a keyword that describes and categorizes the role.
# Users find roles by searching for tags. Be sure to
# remove the '[]' above if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of
# alphanumeric characters. Maximum 20 tags per role.
# List tags for your role here, one per line. A tag is
# a keyword that describes and categorizes the role.
# Users find roles by searching for tags. Be sure to
# remove the '[]' above if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of
# alphanumeric characters. Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line.
# Be sure to remove the '[]' above if you add dependencies
# to this list.
# List your role dependencies here, one per line.
# Be sure to remove the '[]' above if you add dependencies
# to this list.

View File

@ -1,2 +1 @@
pbr>=1.6
ansible

View File

@ -1,3 +1,4 @@
---
- name: register controller nodes
shell: |
source {{ undercloud_rc }}

View File

@ -35,7 +35,7 @@
copy:
src: "{{ ceph_env }}"
dest: "{{ working_dir}}/pre_upgrade_ceph_osd_hieradata_env.yaml"
remote_src: yes
remote_src: true
- name: register environment file
command: "cat {{ ceph_env }}"
@ -62,7 +62,7 @@
- name: set extra_config fact
set_fact:
extra_config: "{{ (ceph_puppet.stdout | from_yaml).parameter_defaults.ExtraConfig }}"
extra_config: "{{ (ceph_puppet.stdout | from_yaml).parameter_defaults.ExtraConfig }}"
- name: remove unused ceph parameters.
lineinfile:
@ -93,7 +93,7 @@
- name: set extra_config from ceph puppet.
set_fact:
extra_config: "{{ (ceph_puppet.stdout | from_yaml).parameter_defaults.ExtraConfig }}"
extra_config: "{{ (ceph_puppet.stdout | from_yaml).parameter_defaults.ExtraConfig }}"
- name: replace empty extraconfig
replace:

View File

@ -1,3 +1,4 @@
---
- name: register control-scale opts
shell: |
grep -oP "control-scale\ \d+" {{ overcloud_deploy_script }}
@ -93,9 +94,16 @@
template:
src: fast-forward-upgrade/cli_opts_params.yaml.j2
dest: "{{working_dir}}/cli_opts_params.yaml"
force: no
force: false
when:
- control_scale|succeeded or compute_scale|succeeded or ceph_scale|succeeded or control_flavor|succeeded or compute_flavor|succeeded or ceph_flavor|succeeded or ntp_server|succeeded
- >
control_scale|succeeded or
compute_scale|succeeded or
ceph_scale|succeeded or
control_flavor|succeeded or
compute_flavor|succeeded or
ceph_flavor|succeeded or
ntp_server|succeeded
- name: check "{{working_dir}}/cli_opts_params.yaml" exists
stat:

View File

@ -1,3 +1,4 @@
---
- name: look for network software config
shell: |
grep "OS::TripleO::.*::Net::SoftwareConfig" {{ item }}

View File

@ -1,3 +1,4 @@
---
- name: Register roles data file location if exists
shell: "grep '\\-r\\ \\|\\-\\-roles' {{ overcloud_deploy_script }} | awk {'print $2'}"
register: custom_roles_file

View File

@ -5,5 +5,5 @@
dest: "{{working_dir}}/{{ item.split('.') | first }}.sh"
mode: 0775
with_items:
- 'fip_http_check_start.sh.j2'
- 'fip_http_check_stop.sh.j2'
- 'fip_http_check_start.sh.j2'
- 'fip_http_check_stop.sh.j2'

View File

@ -1,3 +1,4 @@
---
- block:
- name: create start l3 agent connectivity check scripts
template:

View File

@ -1,3 +1,4 @@
---
- block:
- name: create l3 agent failover check pre script
template:

View File

@ -1,3 +1,4 @@
---
- name: create post nova actions test
template:
src: "nova_actions_check.sh.j2"

View File

@ -16,4 +16,3 @@
src: "{{ l3_agent_connectivity_check_stop_template }}"
dest: "{{ l3_agent_connectivity_check_stop_script }}"
mode: 0775

View File

@ -1,3 +1,4 @@
---
- name: generate inventory file
shell: |
source {{ undercloud_rc }}
@ -14,7 +15,7 @@
oc_roles: "{{ oc_roles + [item.key] }}"
with_dict: "{{ (upgrade_tripleo_inventory.stdout | from_yaml).overcloud.children }}"
- name: register controller role name
- name: register controller role name
set_fact:
controller_role_name: "{{ item|regex_search('[A-Za-z0-9]*[Cc]ontroller[A-Za-z0-9]*') }}"
when: item|regex_search('[A-Za-z0-9]*[Cc]ontroller[A-Za-z0-9]*')

View File

@ -1,3 +1,4 @@
---
- name: look for network software config
shell: |
grep "OS::TripleO::.*::Net::SoftwareConfig" {{ item }}

View File

@ -1,3 +1,4 @@
---
- name: Adjust ssh config to skip host key check
copy:
src: ssh_config

View File

@ -20,62 +20,66 @@
become_user: root
register: loaded_ovs
- block:
- name: reboot the undercloud
shell: "sleep 2 && shutdown -r now"
async: 1
poll: 0
ignore_errors: true
become: true
become_user: root
- name: wait for node to go down
become: no
command: ping -c1 {{ ansible_host }}
register: node_down
until: node_down.rc != 0
retries: 60
delay: 3
ignore_errors: true
delegate_to: localhost
when: "'hypervisor' not in groups and 'virthost' not in groups"
- name: wait for node to go down
command: ping -c1 {{ ansible_host }}
register: node_down
until: node_down.rc != 0
retries: 60
delay: 3
ignore_errors: true
delegate_to: hypervisor
when: "'hypervisor' in groups"
- name: wait for node to go down
command: ping -c1 {{ ansible_host }}
register: node_down
until: node_down.rc != 0
retries: 60
delay: 3
ignore_errors: true
delegate_to: virthost
when: "'virthost' in groups"
- name: waiting for the undercloud to be ssh-able
wait_for_connection:
connect_timeout: 5
sleep: 3
timeout: 630
- name: assert UC services started
shell: |
source {{ undercloud_rc }} ;
timeout 10 openstack stack list -f json | jq -c -r '.[]|.["Stack Name"]'
ignore_errors: true
register: oc_name
until: oc_name.stdout.find('{{ overcloud_stack_name }}') != -1
retries: "{{ service_readiness_count|default(100)|int }}"
delay: 3
when:
- not tripleo_ci and (undercloud_reboot or (installed_kernel.stdout != loaded_kernel.stdout) or (installed_ovs.stdout != loaded_ovs.stdout))
- when:
- not tripleo_ci
- >
undercloud_reboot or
(installed_kernel.stdout != loaded_kernel.stdout) or
(installed_ovs.stdout != loaded_ovs.stdout)
tags: undercloud_reboot
block:
- name: reboot the undercloud
shell: "sleep 2 && shutdown -r now"
async: 1
poll: 0
ignore_errors: true
become: true
become_user: root
- name: wait for node to go down
become: false
command: ping -c1 {{ ansible_host }}
register: node_down
until: node_down.rc != 0
retries: 60
delay: 3
ignore_errors: true
delegate_to: localhost
when: "'hypervisor' not in groups and 'virthost' not in groups"
- name: wait for node to go down
command: ping -c1 {{ ansible_host }}
register: node_down
until: node_down.rc != 0
retries: 60
delay: 3
ignore_errors: true
delegate_to: hypervisor
when: "'hypervisor' in groups"
- name: wait for node to go down
command: ping -c1 {{ ansible_host }}
register: node_down
until: node_down.rc != 0
retries: 60
delay: 3
ignore_errors: true
delegate_to: virthost
when: "'virthost' in groups"
- name: waiting for the undercloud to be ssh-able
wait_for_connection:
connect_timeout: 5
sleep: 3
timeout: 630
- name: assert UC services started
shell: |
source {{ undercloud_rc }} ;
timeout 10 openstack stack list -f json | jq -c -r '.[]|.["Stack Name"]'
ignore_errors: true
register: oc_name
until: oc_name.stdout.find('{{ overcloud_stack_name }}') != -1
retries: "{{ service_readiness_count|default(100)|int }}"
delay: 3

View File

@ -1,3 +1,4 @@
---
- name: Register roles data file location if exists
shell: "grep '\\-r\\ \\|\\-\\-roles' {{ overcloud_deploy_script }} | awk {'print $2'}"
register: custom_roles_file
@ -17,14 +18,14 @@
- name: Clear removed service for roles_data.yaml file
lineinfile:
dest: '{{ custom_roles_file.stdout }}'
regexp: "{{ item }}"
state: absent
dest: '{{ custom_roles_file.stdout }}'
regexp: "{{ item }}"
state: absent
with_items:
- 'OS::TripleO::Services::Core'
- 'OS::TripleO::Services::VipHosts'
- 'OS::TripleO::Services::FluentdClient'
- 'OS::TripleO::Services::ManilaBackendGeneric'
- 'OS::TripleO::Services::Core'
- 'OS::TripleO::Services::VipHosts'
- 'OS::TripleO::Services::FluentdClient'
- 'OS::TripleO::Services::ManilaBackendGeneric'
- name: Assigns deprecated params to Controller role
replace:
@ -72,9 +73,9 @@
- name: Add disable_upgrade_deployment to Compute and ObjectStorage roles
replace:
dest: '{{ custom_roles_file.stdout }}'
regexp: '^(- name: (Compute|ObjectStorage).*$)'
replace: '\1\n disable_upgrade_deployment: True'
dest: '{{ custom_roles_file.stdout }}'
regexp: '^(- name: (Compute|ObjectStorage).*$)'
replace: '\1\n disable_upgrade_deployment: True'
- name: Assigns new attributes to CephStorage role
replace:

View File

@ -1,3 +1,4 @@
---
- name: create {{ current_release }} undercloud upgrade script
template:
src: templates/fast-forward-upgrade/undercloud_upgrade.sh.j2

View File

@ -1,3 +1,4 @@
---
- name: create a comptatible deployment scripts from oooq
include: ../upgrade/use_oooq.yaml
tags: use_oooq
@ -5,7 +6,7 @@
- name: make a copy of the initial overcloud deploy script
copy:
remote_src: yes
remote_src: true
src: "{{ overcloud_deploy_script }}"
dest: "{{ overcloud_deploy_script }}.orig.sh"
@ -37,12 +38,12 @@
dest: "{{working_dir}}/{{ item }}.sh"
mode: 0775
with_items:
- 'post_ffu_undercloud_upgrade_workarounds'
- 'pre_ffu_overcloud_prepare_workarounds'
- 'pre_ffu_overcloud_run_workarounds'
- 'pre_ffu_overcloud_upgrade_workarounds'
- 'pre_ffu_overcloud_converge_workarounds'
- 'pre_ffu_overcloud_ceph_workarounds'
- 'post_ffu_undercloud_upgrade_workarounds'
- 'pre_ffu_overcloud_prepare_workarounds'
- 'pre_ffu_overcloud_run_workarounds'
- 'pre_ffu_overcloud_upgrade_workarounds'
- 'pre_ffu_overcloud_converge_workarounds'
- 'pre_ffu_overcloud_ceph_workarounds'
when: ffu_upgrade_workarounds
- name: Create FFU custom repos environment
@ -56,7 +57,7 @@
src: "fast-forward-upgrade/overcloud_upgrade_run.sh.j2"
dest: "{{working_dir}}/overcloud_upgrade_run.sh"
mode: 0775
force: no
force: false
- name: create overcloud converge script
template:

View File

@ -5,7 +5,7 @@
{{ working_dir }}/ffu_update_stack_outputs.sh 2>&1 {{ timestamper_cmd }} > \
{{ working_dir }}/ffu_update_stack_outputs.log
register: ffu_stack_output
ignore_errors: yes
ignore_errors: true
- name: print stack failures
shell: |

View File

@ -1,10 +1,11 @@
---
- name: upgrade ceph post ffu
shell: |
source {{ undercloud_rc }}
{{ working_dir }}/ffu_upgrade_ceph_script.sh 2>&1 {{ timestamper_cmd }} > \
{{ working_dir }}/ffu_upgrade_ceph.log
register: ffu_upgrade_ceph
ignore_errors: yes
ignore_errors: true
- block:
- name: print stack failures

View File

@ -5,7 +5,7 @@
{{ working_dir }}/ffu_upgrade_converge_script.sh 2>&1 {{ timestamper_cmd }} > \
{{ working_dir }}/ffu_upgrade_converge.log
register: ffu_converge
ignore_errors: yes
ignore_errors: true
- name: print stack failures
shell: |

View File

@ -1,3 +1,4 @@
---
- name: create upgrade prepare scripts
include: create-prepare-scripts.yaml
tags: create_ffu_prepare_scripts
@ -88,28 +89,28 @@
tags: ffu_overcloud_upgrade_role
when: not ffu_bulk|bool
- block:
- name: apply pre ffu ceph upgrade workarounds
command: "{{working_dir}}/pre_ffu_overcloud_ceph_workarounds.sh"
when: ffu_upgrade_workarounds|bool
tags: ffu_overcloud_ceph
- when: ceph_osd_enabled|bool
block:
- name: apply pre ffu ceph upgrade workarounds
command: "{{working_dir}}/pre_ffu_overcloud_ceph_workarounds.sh"
when: ffu_upgrade_workarounds|bool
tags: ffu_overcloud_ceph
- name: run FFU ceph osd nodes ugrade scripts
command: "{{ working_dir }}/overcloud_upgrade_CephStorage.sh"
tags: ffu_overcloud_ceph
- name: run FFU ceph osd nodes upgrade scripts
command: "{{ working_dir }}/overcloud_upgrade_CephStorage.sh"
tags: ffu_overcloud_ceph
- include: ../common/l3_agent_connectivity_check_start_script.yml
tags: ffu_overcloud_ceph
- include: ../common/l3_agent_connectivity_check_start_script.yml
tags: ffu_overcloud_ceph
- include: ../upgrade/ceph_upgrade_run.yml
tags: ffu_overcloud_ceph
- include: ../upgrade/ceph_upgrade_run.yml
tags: ffu_overcloud_ceph
- include: "{{ item }}"
with_items:
- '../common/l3_agent_connectivity_check_stop_script.yml'
- '../common/l3_agent_failover_check_post_script.yml'
tags: ffu_overcloud_ceph
when: ceph_osd_enabled|bool
- include: "{{ item }}"
with_items:
- '../common/l3_agent_connectivity_check_stop_script.yml'
- '../common/l3_agent_failover_check_post_script.yml'
tags: ffu_overcloud_ceph
- name: apply pre ffu overcloud converge workarounds
command: "{{working_dir}}/pre_ffu_overcloud_converge_workarounds.sh"

View File

@ -58,7 +58,7 @@
mode: 0775
tags: ffu_overcloud_upgrade_compute
with_items:
- '{{ tripleo_compute_nodes.stdout_lines }}'
- '{{ tripleo_compute_nodes.stdout_lines }}'
- include: ../common/l3_agent_connectivity_check_start_script.yml
tags: ffu_overcloud_upgrade_compute
@ -67,7 +67,7 @@
command: "{{ working_dir }}/overcloud_upgrade_{{ item }}.sh"
tags: ffu_overcloud_upgrade_compute
with_items:
- '{{ tripleo_compute_nodes.stdout_lines }}'
- '{{ tripleo_compute_nodes.stdout_lines }}'
- include: ../common/l3_agent_connectivity_check_stop_script.yml
tags: ffu_overcloud_upgrade_compute

View File

@ -1,3 +1,4 @@
---
- name: Run pre undercloud {{ current_release }} upgrade workarounds
command: "{{ working_dir }}/pre_undercloud_upgrade_{{ current_release }}_workarounds.sh"
when: ffu_upgrade_workarounds

View File

@ -1,7 +1,7 @@
---
- name: create undercloud update script
template:
src: "{{ undercloud_update_template }}"
src: "{{ undercloud_update_template }}"
dest: "{{ undercloud_update_script }}"
mode: 0775
force: true
@ -16,4 +16,3 @@
- '{{ pre_undercloud_update_workarounds|default([]) }}'
- '{{ post_undercloud_update_workarounds|default([]) }}'
when: updates_workarounds|bool

View File

@ -85,7 +85,7 @@
- include: overcloud_update_run.yml
tags:
- overcloud_update
- overcloud_update
- name: overcloud post-update run workarounds
shell: |
@ -126,8 +126,8 @@
bash {{ overcloud_validate_images_script }} 2>&1 {{ timestamper_cmd }} > \
{{ working_dir}}/validate_oc_images_containers.log
tags:
- overcloud_update
- overcloud_images_validate
- overcloud_update
- overcloud_images_validate
- include: ../common/nova_actions_check.yml

View File

@ -7,7 +7,7 @@
bash {{ overcloud_update_converge_script }} 2>&1 {{ timestamper_cmd }} > \
{{ working_dir }}/overcloud_update_converge.log
register: overcloud_converge_update
ignore_errors: yes
ignore_errors: true
- block:
- name: print stack failures

View File

@ -6,7 +6,7 @@
bash {{ overcloud_update_prepare_script }} 2>&1 {{ timestamper_cmd }} > \
{{ working_dir }}/overcloud_update_prepare.log
register: overcloud_update_prepare
ignore_errors: yes
ignore_errors: true
- block:
- name: print stack failures
@ -26,4 +26,3 @@
- name: was the overcloud update prepare successful.
fail: msg="Overcloud minor update preparation step failed..."
when: overcloud_update_prepare.rc != 0

View File

@ -5,11 +5,11 @@
shell: |
set -o pipefail
bash {{ overcloud_update_run_script_base }}-{{ item }}.sh 2>&1 {{ timestamper_cmd }} > \
{{ working_dir}}/overcloud_update_run_{{ item }}.log
{{ working_dir }}/overcloud_update_run_{{ item }}.log
with_items:
- "{{ oc_roles|default('all') }}"
register: overcloud_update_nodes
ignore_errors: yes
ignore_errors: true
- name: was the overcloud minor update successful.
fail: msg="Overcloud minor update execution step failed..."
@ -17,4 +17,3 @@
when: item.rc != 0
- include: ../common/l3_agent_connectivity_check_stop_script.yml

View File

@ -1,3 +1,4 @@
---
- name: register controller nodes
shell: |
source {{ undercloud_rc }}

View File

@ -35,14 +35,14 @@
dest: "{{working_dir}}/{{ item }}.sh"
mode: 0775
with_items:
- 'pre_overcloud_upgrade_prepare_workarounds'
- 'post_overcloud_upgrade_prepare_workarounds'
- 'pre_overcloud_upgrade_workarounds'
- 'post_overcloud_upgrade_workarounds'
- 'pre_overcloud_upgrade_converge_workarounds'
- 'post_overcloud_upgrade_converge_workarounds'
- 'pre_ceph_upgrade_workarounds'
- 'post_ceph_upgrade_workarounds'
- 'pre_overcloud_upgrade_prepare_workarounds'
- 'post_overcloud_upgrade_prepare_workarounds'
- 'pre_overcloud_upgrade_workarounds'
- 'post_overcloud_upgrade_workarounds'
- 'pre_overcloud_upgrade_converge_workarounds'
- 'post_overcloud_upgrade_converge_workarounds'
- 'pre_ceph_upgrade_workarounds'
- 'post_ceph_upgrade_workarounds'
when: upgrade_workarounds
- include: ../common/create_l3_agent_connectivity_check_script.yml

View File

@ -1,7 +1,7 @@
---
- name: create undercloud upgrade script
template:
src: "{{ undercloud_upgrade_template }}"
src: "{{ undercloud_upgrade_template }}"
dest: "{{ undercloud_upgrade_script }}"
mode: 0775
force: true
@ -12,7 +12,6 @@
dest: "{{working_dir}}/{{ item }}.sh"
mode: 0775
with_items:
- 'pre_undercloud_upgrade_workarounds'
- 'post_undercloud_upgrade_workarounds'
- 'pre_undercloud_upgrade_workarounds'
- 'post_undercloud_upgrade_workarounds'
when: upgrade_workarounds

View File

@ -1,3 +1,4 @@
---
- name: Kill SSH
shell: sleep 1; pkill -u {{ ansible_ssh_user }} sshd
async: 3

View File

@ -163,4 +163,3 @@
- include: ../common/nova_actions_check.yml
when: overcloud_upgrade|bool

View File

@ -5,7 +5,7 @@
bash {{ overcloud_upgrade_converge_script }} 2>&1 {{ timestamper_cmd }} > \
{{ working_dir }}/overcloud_upgrade_converge.log
register: overcloud_converge_upgrade
ignore_errors: yes
ignore_errors: true
- block:
- name: print stack failures

View File

@ -26,7 +26,7 @@
bash {{ overcloud_upgrade_prepare_script }} 2>&1 {{ timestamper_cmd }} > \
{{ working_dir }}/overcloud_upgrade_prepare.log
register: overcloud_upgrade_prepare
ignore_errors: yes
ignore_errors: true
- block:
- name: print stack failures

View File

@ -7,7 +7,7 @@
with_items:
- "{{ oc_roles|default('all') }}"
register: overcloud_upgrade_nodes
ignore_errors: yes
ignore_errors: true
- name: was the overcloud upgrade composable step successful.
fail: msg="Overcloud upgrade composable step failed... :("

View File

@ -1,3 +1,4 @@
---
- name: register undercloud public endpoint
shell: |
source {{ undercloud_rc }}
@ -16,7 +17,7 @@
shell: |
ssh -q -o StrictHostKeyChecking=no {{ oc_user }}@{{ ctrl_ip.stdout }} curl --silent {{ keystone_endpoint.stdout }}
register: uc_keystone_conn
ignore_errors: True
ignore_errors: true
- block:
#

View File

@ -1,6 +1,4 @@
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
bashate>=0.5.1 # Apache-2.0
pre-commit>=1.10 # MIT License
# this is required for the docs build jobs
reno>=2.5.0 # Apache-2.0
sphinx>=1.6.2 # BSD

View File

@ -1,8 +1,8 @@
---
- hosts: undercloud
gather_facts: true
become: yes
become: true
become_method: sudo
become_user: stack
roles:
- { role: tripleo-upgrade, use_oooq: 'true' }
- {role: tripleo-upgrade, use_oooq: 'true'}

View File

@ -1,7 +1,7 @@
---
- hosts: undercloud
gather_facts: true
become: yes
become: true
become_method: sudo
become_user: stack
roles:

47
tox.ini
View File

@ -24,55 +24,30 @@ basepython = python3
commands = python setup.py build_sphinx
[testenv:bashate]
envdir = {toxworkdir}/linters
commands =
# Run bashate check for all bash scripts
# Ignores the following rules:
# E006: Line longer than 79 columns (as many scripts use jinja
# templating, this is very difficult)
# E040: Syntax error determined using `bash -n` (as many scripts
# use jinja templating, this will often fail and the syntax
# error will be discovered in execution anyway)
bash -c "git ls-files | xargs grep --binary-files=without-match \
--files-with-match '^.!.*\(ba\)\?sh$' \
--exclude-dir .tox \
--exclude-dir .git \
| xargs bashate --error . --verbose --ignore=E006,E040"
python -m pre_commit run bashate --all-files
[testenv:pep8]
basepython = python3
envdir = {toxworkdir}/linters
commands =
# Run hacking/flake8 check for all python files
bash -c "git ls-files | grep -v releasenotes | xargs grep --binary-files=without-match \
--files-with-match '^.!.*python$' \
--exclude-dir .tox \
--exclude-dir .git \
--exclude-dir .eggs \
--exclude-dir *.egg-info \
--exclude-dir dist \
--exclude-dir *lib/python* \
--exclude-dir doc \
| xargs flake8 --verbose"
python -m pre_commit run flake8 --all-files
[testenv:ansible-lint]
basepython=python2
envdir = {toxworkdir}/linters
commands =
bash ci-scripts/ansible-lint.sh
[testenv:linters]
basepython = python3
deps =
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/ansible-requirements.txt
commands =
{[testenv:bashate]commands}
{[testenv:pep8]commands}
{[testenv:ansible-lint]commands}
python -m pre_commit run ansible-lint -a
[testenv:releasenotes]
basepython = python3
whitelist_externals = bash
commands = bash -c ci-scripts/releasenotes_tox.sh
[testenv:linters]
commands =
# check only modified files:
python -m pre_commit run --source HEAD^ --origin HEAD
[testenv:venv]
basepython = python3
commands = {posargs}

View File

@ -1,3 +1,4 @@
---
- project:
templates:
- check-requirements