[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:
parent
97664cb9fe
commit
2587cb4acf
@ -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'
|
||||
|
@ -0,0 +1,30 @@
|
||||
---
|
||||
features:
|
||||
|
||||
- |
|
||||
The user can now use a custom script to switch repo during the
|
||||
fast forward upgrade. He/She has to set ``FastForwardRepoType``
|
||||
to ``custom-script`` and set
|
||||
``FastForwardCustomRepoScriptContent`` to a string representing a
|
||||
shell script. That script will be executed on each node and given
|
||||
the upstream name of the release as the first argument (ocata,
|
||||
pike, queens in that order). Here is an example that describes
|
||||
its interface.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
#!/bin/bash
|
||||
case $1 in
|
||||
ocata)
|
||||
curl -o /etc/yum.repos.d/ocata.repo http://somewhere.com/my-Ocata.repo;
|
||||
yum clean metadata;
|
||||
pike)
|
||||
curl -o /etc/yum.repos.d/pike.repo http://somewhere.com/my-Pike.repo;
|
||||
yum clean metadata;
|
||||
queens)
|
||||
curl -o /etc/yum.repos.d/pike.repo http://somewhere.com/my-Queens.repo;
|
||||
yum clean metadata;
|
||||
*)
|
||||
echo "unknown release $1" >&2
|
||||
exit 1
|
||||
esac
|
Loading…
Reference in New Issue
Block a user