File: refresh.py

package info (click to toggle)
python-softlayer 6.2.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,508 kB
  • sloc: python: 57,195; makefile: 133; xml: 97; sh: 59
file content (26 lines) | stat: -rw-r--r-- 944 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
"""Refresh a duplicate volume with a snapshot from its parent."""
# :license: MIT, see LICENSE for more details.

import click
import SoftLayer
from SoftLayer.CLI import environment


@click.command(cls=SoftLayer.CLI.command.SLCommand, )
@click.argument('volume_id')
@click.argument('snapshot_id')
@click.option('--force-refresh', '-f', is_flag=True, default=False, show_default=True,
              help="Cancel current refresh process and initiates the new refresh.")
@environment.pass_env
def cli(env, volume_id, snapshot_id, force_refresh):
    """Refresh a duplicate volume with a snapshot from its parent.

    EXAMPLE::

            slcli block volume-refresh VOLUME_ID SNAPSHOT_ID
            Refresh a duplicate VOLUME_ID with a snapshot from its parent SNAPSHOT_ID.
    """
    block_manager = SoftLayer.BlockStorageManager(env.client)
    resp = block_manager.refresh_dupe(volume_id, snapshot_id, force_refresh)

    click.echo(resp)