Skip to content

Commit 5dffb2f

Browse files
authored
RND-363 Add --legacy parameter for snapshot create (#1474)
* Add --legacy parameter for snapshot create It results in creating a legacy snapshot, i.e. based on a database dump By default this parameter's value is set to `False` for Cloudify >= 7.1 and `True` for version 7.0. * Also enable `--no-legacy` for creating a 'new' snapshot
1 parent 51c46c0 commit 5dffb2f

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

cloudify_cli/cli/cfy.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,6 +1431,13 @@ def __init__(self):
14311431
help=helptexts.TEMPDIR_PATH
14321432
)
14331433

1434+
self.legacy = click.option(
1435+
'--legacy/--no-legacy',
1436+
is_flag=True,
1437+
default=False,
1438+
help=helptexts.LEGACY_SNAPSHOT
1439+
)
1440+
14341441
self.wait_for_status = click.option(
14351442
'-w',
14361443
'--wait-for-status',

cloudify_cli/cli/helptexts.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,7 @@
600600
'drift and run update operations as necessary'
601601
TEMPDIR_PATH = "Temporary location to be used for snapshot creation. If not " \
602602
"specified, /tmp will be used."
603+
LEGACY_SNAPSHOT = "Create legacy version of the snapshot (as opposed to 'new')"
603604
WAIT_FOR_STATUS = "Whether to wait for snapshot status [default: False]."
604605
SUMMARY_HELP = """
605606
Retrieve summary of {type}, e.g. a count of each {example}.

cloudify_cli/commands/snapshots.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
def snapshots():
3838
"""Handle manager snapshots
3939
"""
40-
pass
4140

4241

4342
@snapshots.command(name='restore',
@@ -97,6 +96,7 @@ def restore(snapshot_id,
9796
@cfy.options.common_options
9897
@cfy.options.queue_snapshot
9998
@cfy.options.tempdir_path
99+
@cfy.options.legacy
100100
@cfy.options.wait_for_status
101101
@cfy.pass_client()
102102
@cfy.pass_logger
@@ -106,6 +106,7 @@ def create(snapshot_id,
106106
exclude_events,
107107
queue,
108108
tempdir_path,
109+
legacy,
109110
wait_for_status,
110111
logger,
111112
client):
@@ -124,7 +125,8 @@ def create(snapshot_id,
124125
not exclude_logs,
125126
not exclude_events,
126127
queue,
127-
tempdir_path=tempdir_path)
128+
tempdir_path=tempdir_path,
129+
legacy=legacy)
128130
started_log_msg = "Started workflow execution. The execution's id is" \
129131
" {0}.".format(execution.id)
130132
queued_log_msg = '`queue` flag was passed, snapshot creation will start' \

0 commit comments

Comments
 (0)