File: password.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 (27 lines) | stat: -rw-r--r-- 887 bytes parent folder | download | duplicates (2)
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
27
"""Modifies a password for a volume's access"""
# :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('access_id')
@click.option('--password', '-p', multiple=False,
              help='Password you want to set, this command will fail if the password is not strong.')
@environment.pass_env
def cli(env, access_id, password):
    """Changes a password for a volume's access.

    access id is the allowed_host_id from slcli block access-list
    """

    block_manager = SoftLayer.BlockStorageManager(env.client)

    result = block_manager.set_credential_password(access_id=access_id, password=password)

    if result:
        click.echo('Password updated for %s' % access_id)
    else:
        click.echo('FAILED updating password for %s' % access_id)