Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions ansible/library/reduce_and_add_sonic_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
'''

import sys
from os import path
from ansible.module_utils.basic import *

def exec_command(module, cmd, ignore_error=False, msg="executing command"):
Expand Down Expand Up @@ -74,6 +75,12 @@ def install_new_sonic_image(module, new_image_url):
exec_command(module, cmd="umount /tmp/tmpfs", ignore_error=True)
exec_command(module, cmd="rm -rf /tmp/tmpfs", ignore_error=True)

# If sonic device is configured with minigraph, remove config_db.json
# to force next image to load minigraph.
if path.exists("/host/old_config/minigraph.xml"):
exec_command(module,
cmd="rm /host/old_config/config_db.json",
msg="Remove config_db.json in preference of minigraph.xml")

def main():
module = AnsibleModule(
Expand Down