Skip to content
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

Use config-setup infrastructure to take backup of SONiC configuration #715

Merged
merged 1 commit into from
Dec 4, 2019
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
12 changes: 8 additions & 4 deletions sonic_installer/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,10 @@ def cli():
expose_value=False, prompt='New image will be installed, continue?')
@click.option('-f', '--force', is_flag=True,
help="Force installation of an image of a type which differs from that of the current running image")
@click.option('--skip_migration', is_flag=True,
help="Do not migrate current configuration to the newly installed image")
@click.argument('url')
def install(url, force):
def install(url, force, skip_migration=False):
""" Install image from local binary or URL"""
cleanup_image = False
if get_running_image_type() == IMAGE_TYPE_ABOOT:
Expand Down Expand Up @@ -361,9 +363,11 @@ def install(url, force):
else:
run_command("bash " + image_path)
run_command('grub-set-default --boot-directory=' + HOST_PATH + ' 0')
run_command("rm -rf /host/old_config")
# copy directories and preserve original file structure, attributes and associated metadata
run_command("cp -ar /etc/sonic /host/old_config")
# Take a backup of current configuration
if skip_migration:
click.echo("Skipping configuration migration as requested in the command option.")
else:
run_command('config-setup backup')

# Finally, sync filesystem
run_command("sync;sync;sync")
Expand Down