Skip to content

Commit 6c939d6

Browse files
caberoscaberos
authored andcommitted
fix the merge conflicts
2 parents 83a2c3d + be23dbb commit 6c939d6

33 files changed

+261
-568
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
"""Order/create a provisioning script."""
2+
# :license: MIT, see LICENSE for more details.
3+
4+
import click
5+
6+
import SoftLayer
7+
from SoftLayer.CLI import environment
8+
from SoftLayer.CLI import formatting
9+
10+
11+
@click.command(cls=SoftLayer.CLI.command.SLCommand)
12+
@click.option('--name', '-N', required=True, prompt=True, help="The name of the hook.")
13+
@click.option('--uri', '-U', required=True, prompt=True, help="The endpoint that the script will be downloaded")
14+
@environment.pass_env
15+
def cli(env, name, uri):
16+
"""Order/create a provisioning script."""
17+
18+
manager = SoftLayer.AccountManager(env.client)
19+
20+
provisioning = manager.create_provisioning(name, uri)
21+
22+
table = formatting.KeyValueTable(['name', 'value'])
23+
table.align['name'] = 'r'
24+
table.align['value'] = 'l'
25+
26+
table.add_row(['Id', provisioning.get('id')])
27+
table.add_row(['Name', provisioning.get('name')])
28+
table.add_row(['Created', provisioning.get('createDate')])
29+
table.add_row(['Uri', provisioning.get('uri')])
30+
31+
env.fout(table)

SoftLayer/CLI/autoscale/__init__.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

SoftLayer/CLI/autoscale/delete.py

Lines changed: 0 additions & 27 deletions
This file was deleted.

SoftLayer/CLI/autoscale/detail.py

Lines changed: 0 additions & 93 deletions
This file was deleted.

SoftLayer/CLI/autoscale/list.py

Lines changed: 0 additions & 30 deletions
This file was deleted.

SoftLayer/CLI/block/limit.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,30 @@
1515

1616
@click.command(cls=SoftLayer.CLI.command.SLCommand, )
1717
@click.option('--sortby', help='Column to sort by', default='Datacenter')
18+
@click.option('--datacenter', '-d', help='Filter by datacenter')
1819
@environment.pass_env
19-
def cli(env, sortby):
20+
def cli(env, sortby, datacenter):
2021
"""List number of block storage volumes limit per datacenter."""
2122
block_manager = SoftLayer.BlockStorageManager(env.client)
2223
block_volumes = block_manager.list_block_volume_limit()
2324

2425
table = formatting.KeyValueTable(DEFAULT_COLUMNS)
2526
table.sortby = sortby
26-
for volume in block_volumes:
27-
datacenter_name = volume['datacenterName']
28-
maximum_available_count = volume['maximumAvailableCount']
29-
provisioned_count = volume['provisionedCount']
30-
table.add_row([datacenter_name, maximum_available_count, provisioned_count])
27+
28+
for volumen in block_volumes:
29+
if datacenter:
30+
if volumen.get('datacenterName') != '':
31+
if volumen.get('datacenterName') == datacenter:
32+
table.add_row([volumen.get('datacenterName'),
33+
volumen.get('maximumAvailableCount'),
34+
volumen.get('provisionedCount')])
35+
break
36+
else:
37+
if volumen.get('datacenterName') != '':
38+
table.add_row([volumen.get('datacenterName'), volumen.get('maximumAvailableCount'),
39+
volumen.get('provisionedCount')])
40+
else:
41+
table.add_row([' - ',
42+
volumen.get('maximumAvailableCount'),
43+
volumen.get('provisionedCount')])
3144
env.fout(table)

SoftLayer/CLI/file/limit.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,29 @@
1515

1616
@click.command(cls=SoftLayer.CLI.command.SLCommand, )
1717
@click.option('--sortby', help='Column to sort by', default='Datacenter')
18+
@click.option('--datacenter', '-d', help='Filter by datacenter')
1819
@environment.pass_env
19-
def cli(env, sortby):
20+
def cli(env, sortby, datacenter):
2021
"""List number of block storage volumes limit per datacenter."""
2122
file_manager = SoftLayer.FileStorageManager(env.client)
2223
file_volumes = file_manager.list_file_volume_limit()
2324

2425
table = formatting.KeyValueTable(DEFAULT_COLUMNS)
2526
table.sortby = sortby
26-
for volume in file_volumes:
27-
datacenter_name = volume['datacenterName']
28-
maximum_available_count = volume['maximumAvailableCount']
29-
provisioned_count = volume['provisionedCount']
30-
table.add_row([datacenter_name, maximum_available_count, provisioned_count])
27+
for volumen in file_volumes:
28+
if datacenter:
29+
if volumen.get('datacenterName') != '':
30+
if volumen.get('datacenterName') == datacenter:
31+
table.add_row([volumen.get('datacenterName'),
32+
volumen.get('maximumAvailableCount'),
33+
volumen.get('provisionedCount')])
34+
break
35+
else:
36+
if volumen.get('datacenterName') != '':
37+
table.add_row([volumen.get('datacenterName'), volumen.get('maximumAvailableCount'),
38+
volumen.get('provisionedCount')])
39+
else:
40+
table.add_row([' - ',
41+
volumen.get('maximumAvailableCount'),
42+
volumen.get('provisionedCount')])
3143
env.fout(table)

SoftLayer/CLI/image/share.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
"""Share an image template with another account."""
2+
# :license: MIT, see LICENSE for more details.
3+
4+
import click
5+
6+
import SoftLayer
7+
from SoftLayer.CLI import environment
8+
from SoftLayer.CLI import helpers
9+
10+
11+
@click.command(cls=SoftLayer.CLI.command.SLCommand, )
12+
@click.argument('identifier')
13+
@click.option('--account-id', help='Account Id for another account to share image template', required=True)
14+
@environment.pass_env
15+
def cli(env, identifier, account_id):
16+
"""Share an image template with another account."""
17+
18+
image_mgr = SoftLayer.ImageManager(env.client)
19+
image_id = helpers.resolve_id(image_mgr.resolve_ids, identifier, 'image')
20+
shared_image = image_mgr.share_image(image_id, account_id)
21+
22+
if shared_image:
23+
env.fout("Image template {} was shared to account {}.".format(identifier, account_id))

SoftLayer/CLI/routes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
('account:orders', 'SoftLayer.CLI.account.orders:cli'),
2626
('account:bandwidth-pools', 'SoftLayer.CLI.account.bandwidth_pools:cli'),
2727
('account:hooks', 'SoftLayer.CLI.account.hooks:cli'),
28+
('account:hook-create', 'SoftLayer.CLI.account.hook_create:cli'),
2829
('account:hook-delete', 'SoftLayer.CLI.account.hook_delete:cli'),
2930

3031
('virtual', 'SoftLayer.CLI.virt'),

SoftLayer/CLI/virt/capture.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
@click.command(cls=SoftLayer.CLI.command.SLCommand, short_help="Capture SoftLayer image.")
1515
@click.argument('identifier')
1616
@click.option('--name', '-n', required=True, help="Name of the image")
17-
@click.option('--all', help="Capture all disks belonging to the VS")
17+
@click.option('--all', is_flag=True, default=False, help="Capture all disks belonging to the VS")
1818
@click.option('--note', help="Add a note to be associated with the image")
1919
@environment.pass_env
2020
def cli(env, identifier, name, all, note):

0 commit comments

Comments
 (0)