[FFU] Hook to allow user to pass a custom script for repo switching.

This allow the user to use whatever script is necessary to switch repo
in its own infrastructure during fast forward upgrade.

Change-Id: Ie74106de7a4d5cd761c2bd836c2aa03efa7ac091
This commit is contained in:
Sofer Athlan-Guyot
2018-01-31 12:43:01 +01:00
parent 97664cb9fe
commit 2587cb4acf
2 changed files with 65 additions and 0 deletions

View File

@@ -37,9 +37,20 @@ parameters:
FastForwardRepoType:
default: 'tripleo-repos'
type: string
constraints:
- allowed_values: ['tripleo-repos', 'custom-script']
FastForwardRepoArgs:
default: {'tripleo_repos': {'ocata': '-b ocata current', 'pike': '-b pike current', 'queens': '-b queens current'}}
type: json
FastForwardCustomRepoScriptContent:
default: |
#!/bin/bash
set -e
echo "If you use FastForwardRepoType 'custom-script' you have to provide the upgrade repo script content."
echo "It will be installed as /root/ffu_upgrade_repo.sh on the node"
echo "and passed the upstream name (ocata, pike, queens) of the release as first argument"
exit 1
type: string
outputs:
role_data:
@@ -119,6 +130,18 @@ outputs:
- step|int == 3
- ffu_packages_apply|bool
- fast_forward_repo_type == 'tripleo-repos'
- block:
- name: Create custom Script for upgrading repo.
copy:
dest: /root/ffu_update_repo.sh
content: {get_param: FastForwardCustomRepoScriptContent}
mode: 0700
- name: Execute custom script for upgrading repo.
shell: "/root/ffu_update_repo.sh {{release}}"
when:
- step|int == 3
- ffu_packages_apply|bool
- fast_forward_repo_type == 'custom-script'
fast_forward_post_upgrade_tasks:
- name: Register repo type and args
set_fact:
@@ -140,3 +163,15 @@ outputs:
when:
- ffu_packages_apply|bool
- fast_forward_repo_type == 'tripleo-repos'
- block:
- name: Create custom Script for upgrading repo.
copy:
dest: /root/ffu_update_repo.sh
content: {get_param: FastForwardCustomRepoScriptContent}
mode: 0700
- name: Execute custom script for upgrading repo.
shell: "/root/ffu_update_repo.sh {{release}}"
when:
- ffu_packages_apply|bool
- fast_forward_repo_type == 'custom-script'