summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Ptacek <m.ptacek@partner.samsung.com>2019-02-28 17:43:49 +0000
committerMichal Ptacek <m.ptacek@partner.samsung.com>2019-02-28 17:46:17 +0000
commit09bf8b39716d61a0e1f733d8563137aacba942e5 (patch)
treeba832601ec508f517ff0b45e4132b2f331a1b76c
parent3313c854585836ec97b72e2ff82d9ed4bf4ed710 (diff)
Dont crash patching on missing chart file
In some deployments not all chart files might be present. We should not fail if some components are not deployed. Issue-ID: OOM-1691 Change-Id: I6a0ae05e753a2de6301ee0188022a958868776ad Signed-off-by: Michal Ptacek <m.ptacek@partner.samsung.com>
-rw-r--r--patches/onap-casablanca-patch-role/tasks/main.yml36
1 files changed, 25 insertions, 11 deletions
diff --git a/patches/onap-casablanca-patch-role/tasks/main.yml b/patches/onap-casablanca-patch-role/tasks/main.yml
index d3b92e5b..00ee4577 100644
--- a/patches/onap-casablanca-patch-role/tasks/main.yml
+++ b/patches/onap-casablanca-patch-role/tasks/main.yml
@@ -1,34 +1,48 @@
---
# This role contains patching logic for OOM charts
# and is valid until OOM-1610 is implemented
+- name: Check presence of files for NPM patching
+ stat:
+ path: "{{ app_helm_charts_infra_directory }}/{{ item }}"
+ with_items:
+ - common/dgbuilder/templates/deployment.yaml
+ - sdnc/charts/sdnc-portal/templates/deployment.yaml
+ register: npm_files_check
+
+- name: Check presence of dcae cloudify deployment chart file
+ stat:
+ path: "{{ app_helm_charts_infra_directory }}/{{ item }}"
+ with_items:
+ - dcaegen2/charts/dcae-cloudify-manager/templates/deployment.yaml
+ register: dcae_files_check
+
- name: Patch OOM - nexus domain resolving
lineinfile:
- path: "{{ app_helm_charts_infra_directory }}/{{ item }}"
+ path: "{{ item.stat.path }}"
regexp: '^(.*)HOSTS_FILE_RECORD'
line: '\g<1>{{ cluster_ip }} {{ simulated_hosts.nexus | join(" ") }} >> /etc/hosts;'
backrefs: yes
state: present
- with_items:
- - common/dgbuilder/templates/deployment.yaml
- - sdnc/charts/sdnc-portal/templates/deployment.yaml
+ with_items: "{{ npm_files_check.results }}"
+ when: item.stat.exists
- name: Patch OOM - set npm registry
lineinfile:
- path: "{{ app_helm_charts_infra_directory }}/{{ item }}"
+ path: "{{ item.stat.path }}"
regexp: '^(.*)NPM_REGISTRY_RECORD'
line: '\g<1>npm set registry "http://nexus.{{ ansible_nodename }}/repository/npm-private/";'
backrefs: yes
state: present
- with_items:
- - common/dgbuilder/templates/deployment.yaml
- - sdnc/charts/sdnc-portal/templates/deployment.yaml
+ with_items: "{{ npm_files_check.results }}"
+ when: item.stat.exists
- name: Patch OOM - set cert path for cloudify
lineinfile:
- path: "{{ app_helm_charts_infra_directory }}/{{ item }}"
+ path: "{{ item.stat.path }}"
regexp: '^(.*)CERT_PATH'
line: '\g<1>/etc/pki/ca-trust/source/anchors'
backrefs: yes
state: present
- with_items:
- - dcaegen2/charts/dcae-cloudify-manager/templates/deployment.yaml
+ with_items: "{{ dcae_files_check.results }}"
+ when: item.stat.exists
+