aboutsummaryrefslogtreecommitdiffstats
path: root/installation
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2019-05-13 12:52:04 +0000
committerGerrit Code Review <gerrit@onap.org>2019-05-13 12:52:04 +0000
commit0f23c0807bf0b82a5a8822192c538313bdf1c46e (patch)
treef856e651cc6c115fba6c361117dee80fc2975f6a /installation
parente623fec5597c6a6eb88026cd4b6de7185729dfcd (diff)
parent52f453cca65d3276ab860843ee34369a2d54dbb9 (diff)
Merge "Fix missing payload for DGs and Playbooks of SW upgrade" into dublin
Former-commit-id: 716fdbce186a44cf99834fc68df21ed8b2e4e1d3
Diffstat (limited to 'installation')
-rw-r--r--installation/ansible-server/src/main/Playbooks/ansible_huawei_postcheck@0.01.yml22
-rw-r--r--installation/ansible-server/src/main/Playbooks/ansible_huawei_precheck@0.01.yml22
-rw-r--r--installation/ansible-server/src/main/Playbooks/ansible_huawei_rollback@0.00.yml11
-rw-r--r--installation/ansible-server/src/main/Playbooks/ansible_huawei_upgrade@0.01.yml63
4 files changed, 104 insertions, 14 deletions
diff --git a/installation/ansible-server/src/main/Playbooks/ansible_huawei_postcheck@0.01.yml b/installation/ansible-server/src/main/Playbooks/ansible_huawei_postcheck@0.01.yml
index ad4edf51..b9b1ab81 100644
--- a/installation/ansible-server/src/main/Playbooks/ansible_huawei_postcheck@0.01.yml
+++ b/installation/ansible-server/src/main/Playbooks/ansible_huawei_postcheck@0.01.yml
@@ -3,13 +3,11 @@
tasks:
- name: create a temporary file for additional data
file:
- path: /tmp/tmp-{{Id}}
- state: touch
- become: false
+ path: /tmp/tmp-{{Id}}
+ state: touch
- name: prepare additional data
shell: echo {{additionalData}} > /tmp/tmp-{{Id}}
- become: false
- name: execute post-check operation
shell: ./swm/upgrade-post-check {{pnfId}} {{oldSwVersion}} {{targetSwVersion}} {{ruleName}} /tmp/tmp-{{Id}}
@@ -22,9 +20,19 @@
- name: remove the temporary file
file:
- path: /tmp/tmp-{{Id}}
- state: absent
- become: false
+ path: /tmp/tmp-{{Id}}
+ state: absent
+
+ - name: build error message
+ set_fact:
+ err_msg:
+ "reason": "{{postcheck_result.stderr}}"
+ "result": "Failure"
+ when: postcheck_result is failed and postcheck_result.stdout == "" and postcheck_result.stderr != ""
+
+ - name: write error message to file
+ local_action: copy content="{{err_msg}}" dest="{{inventory_dir}}/{{inventory_hostname}}_results.txt"
+ when: postcheck_result is failed and postcheck_result.stdout == "" and postcheck_result.stderr != ""
- name: use result of post-check as the result of Playbook
fail:
diff --git a/installation/ansible-server/src/main/Playbooks/ansible_huawei_precheck@0.01.yml b/installation/ansible-server/src/main/Playbooks/ansible_huawei_precheck@0.01.yml
index 668ed7d0..dcb6f6a0 100644
--- a/installation/ansible-server/src/main/Playbooks/ansible_huawei_precheck@0.01.yml
+++ b/installation/ansible-server/src/main/Playbooks/ansible_huawei_precheck@0.01.yml
@@ -3,13 +3,11 @@
tasks:
- name: create a temporary file for additional data
file:
- path: /tmp/tmp-{{Id}}
- state: touch
- become: false
+ path: /tmp/tmp-{{Id}}
+ state: touch
- name: prepare additional data
shell: echo {{additionalData}} > /tmp/tmp-{{Id}}
- become: false
- name: execute pre-check operation
shell: ./swm/upgrade-pre-check {{pnfId}} {{oldSwVersion}} {{targetSwVersion}} {{ruleName}} /tmp/tmp-{{Id}}
@@ -22,9 +20,19 @@
- name: remove the temporary file
file:
- path: /tmp/tmp-{{Id}}
- state: absent
- become: false
+ path: /tmp/tmp-{{Id}}
+ state: absent
+
+ - name: build error message
+ set_fact:
+ err_msg:
+ "reason": "{{precheck_result.stderr}}"
+ "result": "Failure"
+ when: precheck_result is failed and precheck_result.stdout == "" and precheck_result.stderr != ""
+
+ - name: write error message to file
+ local_action: copy content="{{err_msg}}" dest="{{inventory_dir}}/{{inventory_hostname}}_results.txt"
+ when: precheck_result is failed and precheck_result.stdout == "" and precheck_result.stderr != ""
- name: use result of pre-check as the result of Playbook
fail:
diff --git a/installation/ansible-server/src/main/Playbooks/ansible_huawei_rollback@0.00.yml b/installation/ansible-server/src/main/Playbooks/ansible_huawei_rollback@0.00.yml
index fa164c9c..8d8982af 100644
--- a/installation/ansible-server/src/main/Playbooks/ansible_huawei_rollback@0.00.yml
+++ b/installation/ansible-server/src/main/Playbooks/ansible_huawei_rollback@0.00.yml
@@ -11,6 +11,17 @@
local_action: copy content="{{fallback_result.stdout}}" dest="{{inventory_dir}}/{{inventory_hostname}}_results.txt"
when: fallback_result.stdout != ""
+ - name: build error message
+ set_fact:
+ err_msg:
+ "reason": "{{fallback_result.stderr}}"
+ "result": "Failure"
+ when: fallback_result is failed and fallback_result.stdout == "" and fallback_result.stderr != ""
+
+ - name: write error message to file
+ local_action: copy content="{{err_msg}}" dest="{{inventory_dir}}/{{inventory_hostname}}_results.txt"
+ when: fallback_result is failed and fallback_result.stdout == "" and fallback_result.stderr != ""
+
- name: use result of swFallback as the result of Playbook
fail:
msg: "{{fallback_result.stderr}}"
diff --git a/installation/ansible-server/src/main/Playbooks/ansible_huawei_upgrade@0.01.yml b/installation/ansible-server/src/main/Playbooks/ansible_huawei_upgrade@0.01.yml
index 4ebe69f0..c4b76b0f 100644
--- a/installation/ansible-server/src/main/Playbooks/ansible_huawei_upgrade@0.01.yml
+++ b/installation/ansible-server/src/main/Playbooks/ansible_huawei_upgrade@0.01.yml
@@ -38,8 +38,25 @@
- name: execute downloadNESw operation
shell: ./swm/downloadNESw --swToBeDownloaded {{sw_to_be_downloaded}} --neIdentifier {{ne_identifier}}
+ ignore_errors: yes
register: download_result
+ - name: build error message for downloadNESw
+ set_fact:
+ download_err_msg:
+ "reason": "downloadNESw failure"
+ "result": "Failure"
+ when: download_result is failed
+
+ - name: write error message to file for downloadNESw
+ local_action: copy content="{{download_err_msg}}" dest="{{inventory_dir}}/{{inventory_hostname}}_results.txt"
+ when: download_result is failed
+
+ - name: use result of downloadNESw as the result of Playbook
+ fail:
+ msg: "{{download_err_msg}}"
+ when: download_result is failed
+
- name: parse response of downloadNESw
set_fact:
download_response: "{{ download_result.stdout | from_json }}"
@@ -67,11 +84,13 @@
- name: execute installNESw operation
shell: ./swm/installNESw --swToBeInstalled {{item}} --neIdentifier {{ne_identifier}}
+ ignore_errors: yes
register: install_result
with_items: "{{ downloaded_ne_sw_info | default([]) }}"
- name: execute installNESw operation using new parameter
shell: ./swm/installNESw --swToBeInstalled {{item}} --neIdentifier {{ne_identifier}}
+ ignore_errors: yes
register: install_result_new
with_items: "{{ sw_to_be_installed | default([]) }}"
@@ -80,6 +99,22 @@
install_result: "{{ install_result_new }}"
when: swToBeInstalled is defined
+ - name: build error message for installNESw
+ set_fact:
+ install_err_msg:
+ "reason": "installNESw failure"
+ "result": "Failure"
+ when: install_result is failed
+
+ - name: write error message to file for installNESw
+ local_action: copy content="{{install_err_msg}}" dest="{{inventory_dir}}/{{inventory_hostname}}_results.txt"
+ when: install_result is failed
+
+ - name: use result of installNESw as the result of Playbook
+ fail:
+ msg: "{{install_err_msg}}"
+ when: install_result is failed
+
- name: set install results list
set_fact:
install_results_list: "{{ install_result.results }}"
@@ -112,11 +147,13 @@
- name: execute activateNESw operation
shell: ./swm/activateNESw --swVersionToBeActivated {{item}} --neIdentifier {{ne_identifier}}
+ ignore_errors: yes
register: activate_result
with_items: "{{ installed_ne_sw_info | default([]) }}"
- name: execute activateNESw operation using new parameter
shell: ./swm/activateNESw --swVersionToBeActivated {{sw_version_to_be_activated}} --neIdentifier {{ne_identifier}}
+ ignore_errors: yes
register: activate_result_new
when: swVersionToBeActivated is defined
@@ -125,3 +162,29 @@
activate_result: "{{ activate_result_new }}"
when: swVersionToBeActivated is defined
+ - name: build error message for activateNESw
+ set_fact:
+ activate_err_msg:
+ "reason": "activateNESw failure"
+ "result": "Failure"
+ when: activate_result is failed
+
+ - name: write error message to file for activateNESw
+ local_action: copy content="{{activate_err_msg}}" dest="{{inventory_dir}}/{{inventory_hostname}}_results.txt"
+ when: activate_result is failed
+
+ - name: use result of activateNESw as the result of Playbook
+ fail:
+ msg: "{{activate_err_msg}}"
+ when: activate_result is failed
+
+ - name: build success message for activateNESw
+ set_fact:
+ activate_success_msg:
+ "result": "Success"
+ when: activate_result is not failed
+
+ - name: write success message to file for activateNESw
+ local_action: copy content="{{activate_success_msg}}" dest="{{inventory_dir}}/{{inventory_hostname}}_results.txt"
+ when: activate_result is not failed
+