-
Notifications
You must be signed in to change notification settings - Fork 1k
Move image processing from advanced-reboot.yml to separate file #930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
51971fe
Moved image processing from advanced-reboot.yml to separate file rebo…
yvolynets-mlnx a6bf957
Moved image processing from advanced-reboot.yml to separate file rebo…
yvolynets-mlnx d3a2945
Merge branch 'fix_1775504' of https://github.com/yvolynets-mlnx/sonic…
yvolynets-mlnx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
ansible/roles/test/tasks/advanced_reboot/reboot-image-handle.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| - block: | ||
| - fail: msg="Please set new_sonic_image variable" | ||
| when: new_sonic_image is not defined | ||
|
|
||
| - fail: msg="Please set cleanup_old_sonic_images variable" | ||
| when: cleanup_old_sonic_images is not defined | ||
|
|
||
| - fail: msg="Please set stay_in_target_image variable" | ||
| when: stay_in_target_image is not defined | ||
|
|
||
| - name: Save image version | ||
| shell: 'sonic_installer list | grep Current | cut -f2 -d " "' | ||
| register: current_sonic_image | ||
| become: true | ||
| when: not stay_in_target_image | ||
|
|
||
| - name: Generate temp file name on target device | ||
| shell: mktemp | ||
| register: tempfile | ||
|
|
||
| - set_fact: | ||
| new_image_location: '{{ tempfile.stdout }}' | ||
|
|
||
| - debug: msg='Setting image file name to {{ new_image_location }}' | ||
|
|
||
| - name: Download SONiC image. | ||
| local_action: get_url url={{ new_sonic_image }} dest={{ new_image_location }} | ||
|
|
||
| - name: Upload SONiC image to device. | ||
| copy: | ||
| src: "{{ new_image_location }}" | ||
| dest: "{{ new_image_location }}" | ||
|
|
||
| - name: Cleanup sonic images that is not current and/or next | ||
| shell: sonic_installer cleanup -y | ||
| become: true | ||
| when: cleanup_old_sonic_images | ||
|
|
||
| - name: 'Setup restoring initial image {{ current_sonic_image }}' | ||
| shell: /bin/true | ||
| connection: local | ||
| notify: | ||
| - restore current image | ||
| - reboot sonic | ||
| when: not stay_in_target_image | ||
|
|
||
| - name: Installing new SONiC image | ||
| shell: sonic_installer install -y {{ new_image_location }} | ||
| become: true |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.