Skip to content

Commit 154cccb

Browse files
caberoscaberos
authored andcommitted
fix the merge conflicts
2 parents 1ccbb07 + 1f4c7d4 commit 154cccb

27 files changed

Lines changed: 173 additions & 49 deletions

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
# Change Log
22

33

4+
## [6.0.2] - 2022-03-30
5+
6+
## What's Changed
7+
* New Command slcli hardware|virtual monitoring by @caberos in https://github.com/softlayer/softlayer-python/pull/1593
8+
* When listing datacenters/pods, mark those that are closing soon. by @caberos in https://github.com/softlayer/softlayer-python/pull/1597
9+
10+
11+
**Full Changelog**: https://github.com/softlayer/softlayer-python/compare/v6.0.1...v6.0.2
12+
413
## [6.0.1] - 2022-03-11
514

615

SoftLayer/CLI/account/cancel_item.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ def cli(env, identifier):
1515
manager = AccountManager(env.client)
1616
item = manager.cancel_item(identifier)
1717

18-
env.fout(item)
18+
if item:
19+
env.fout("Item: {} was cancelled.".format(identifier))

SoftLayer/CLI/account/event_detail.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ def update_table(event):
6565
"""Formats a basic event update table"""
6666
update_number = 0
6767
for update in event.get('updates', []):
68+
update_number = update_number + 1
6869
header = "======= Update #%s on %s =======" % (update_number, utils.clean_time(update.get('startDate')))
6970
click.secho(header, fg='green')
70-
update_number = update_number + 1
7171
text = update.get('contents')
7272
# deals with all the \r\n from the API
7373
click.secho(utils.clean_splitlines(text))

SoftLayer/CLI/account/events.py

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,14 @@
1111
@click.command()
1212
@click.option('--ack-all', is_flag=True, default=False,
1313
help="Acknowledge every upcoming event. Doing so will turn off the popup in the control portal")
14+
@click.option('--planned', is_flag=True, default=False,
15+
help="Show only planned events")
16+
@click.option('--unplanned', is_flag=True, default=False,
17+
help="Show only unplanned events")
18+
@click.option('--announcement', is_flag=True, default=False,
19+
help="Show only announcement events")
1420
@environment.pass_env
15-
def cli(env, ack_all):
21+
def cli(env, ack_all, planned, unplanned, announcement):
1622
"""Summary and acknowledgement of upcoming and ongoing maintenance events"""
1723

1824
manager = AccountManager(env.client)
@@ -21,13 +27,22 @@ def cli(env, ack_all):
2127
announcement_events = manager.get_upcoming_events("ANNOUNCEMENT")
2228

2329
add_ack_flag(planned_events, manager, ack_all)
24-
env.fout(planned_event_table(planned_events))
25-
2630
add_ack_flag(unplanned_events, manager, ack_all)
27-
env.fout(unplanned_event_table(unplanned_events))
28-
2931
add_ack_flag(announcement_events, manager, ack_all)
30-
env.fout(announcement_event_table(announcement_events))
32+
33+
if planned:
34+
env.fout(planned_event_table(planned_events))
35+
36+
if unplanned:
37+
env.fout(unplanned_event_table(unplanned_events))
38+
39+
if announcement:
40+
env.fout(announcement_event_table(announcement_events))
41+
42+
if not planned and not unplanned and not announcement:
43+
env.fout(planned_event_table(planned_events))
44+
env.fout(unplanned_event_table(unplanned_events))
45+
env.fout(announcement_event_table(announcement_events))
3146

3247

3348
def add_ack_flag(events, manager, ack_all):

SoftLayer/CLI/account/item_detail.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def item_table(item):
2828
table.add_row(['cancellationDate', utils.clean_time(item.get('cancellationDate'), date_format, date_format)])
2929
table.add_row(['description', item.get('description')])
3030
table.align = 'l'
31-
fqdn = "{}.{}".format(item.get('hostName'), item.get('domain'))
31+
fqdn = "{}.{}".format(item.get('hostName', ''), item.get('domainName', ''))
3232
if fqdn != ".":
3333
table.add_row(['FQDN', fqdn])
3434

SoftLayer/CLI/globalip/assign.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,22 @@
55

66
import SoftLayer
77
from SoftLayer.CLI import environment
8-
from SoftLayer.CLI import helpers
98

9+
target_types = {'vlan': 'SoftLayer_Network_Vlan',
10+
'ip': 'SoftLayer_Network_Subnet_IpAddress',
11+
'hardware': 'SoftLayer_Hardware_Server',
12+
'vsi': 'SoftLayer_Virtual_Guest'}
1013

11-
@click.command()
14+
15+
@click.command(epilog="More information about types and identifiers "
16+
"on https://sldn.softlayer.com/reference/services/SoftLayer_Network_Subnet/route/")
1217
@click.argument('identifier')
13-
@click.argument('target')
18+
@click.option('--target', type=click.Choice(['vlan', 'ip', 'hardware', 'vsi']),
19+
help='choose the type. vlan, ip, hardware, vsi')
20+
@click.option('--target-id', help='The identifier for the destination resource to route this subnet to. ')
1421
@environment.pass_env
15-
def cli(env, identifier, target):
16-
"""Assigns the global IP to a target."""
22+
def cli(env, identifier, target, target_id):
23+
"""Assigns the subnet to a target."""
1724

1825
mgr = SoftLayer.NetworkManager(env.client)
19-
global_ip_id = helpers.resolve_id(mgr.resolve_global_ip_ids, identifier,
20-
name='global ip')
21-
mgr.assign_global_ip(global_ip_id, target)
26+
mgr.route(identifier, target_types.get(target), target_id)

SoftLayer/CLI/hardware/create.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@
4141
def cli(env, **args):
4242
"""Order/create a dedicated server."""
4343
mgr = SoftLayer.HardwareManager(env.client)
44+
network = SoftLayer.NetworkManager(env.client)
45+
46+
pods = network.get_closed_pods()
47+
closure = []
4448

4549
# Get the SSH keys
4650
ssh_keys = []
@@ -99,6 +103,10 @@ def cli(env, **args):
99103
return
100104

101105
if do_create:
106+
for pod in pods:
107+
if args.get('datacenter') in str(pod['name']):
108+
closure.append(pod['name'])
109+
click.secho(click.style('Warning: Closed soon: %s' % (', '.join(closure)), fg='yellow'))
102110
if not (env.skip_confirmations or formatting.confirm(
103111
"This action will incur charges on your account. Continue?")):
104112
raise exceptions.CLIAbort('Aborting dedicated server order.')

SoftLayer/CLI/licenses/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
"""VMware licenses."""
2+
# :license: MIT, see LICENSE for more details.

SoftLayer/CLI/order/place.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from SoftLayer.CLI import environment
99
from SoftLayer.CLI import exceptions
1010
from SoftLayer.CLI import formatting
11+
from SoftLayer.managers import NetworkManager
1112
from SoftLayer.managers import ordering
1213

1314
COLUMNS = ['keyName',
@@ -64,6 +65,10 @@ def cli(env, package_keyname, location, preset, verify, billing, complex_type,
6465
6566
"""
6667
manager = ordering.OrderingManager(env.client)
68+
network = NetworkManager(env.client)
69+
70+
pods = network.get_closed_pods()
71+
closure = []
6772

6873
if extras:
6974
try:
@@ -90,6 +95,9 @@ def cli(env, package_keyname, location, preset, verify, billing, complex_type,
9095
])
9196

9297
else:
98+
for pod in pods:
99+
closure.append(pod['name'])
100+
click.secho(click.style('Warning: Closed soon: %s' % (', '.join(closure)), fg='yellow'))
93101
if not (env.skip_confirmations or formatting.confirm(
94102
"This action will incur charges on your account. Continue?")):
95103
raise exceptions.CLIAbort("Aborting order.")

SoftLayer/CLI/routes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@
323323
('subnet:list', 'SoftLayer.CLI.subnet.list:cli'),
324324
('subnet:lookup', 'SoftLayer.CLI.subnet.lookup:cli'),
325325
('subnet:edit-ip', 'SoftLayer.CLI.subnet.edit_ip:cli'),
326+
('subnet:route', 'SoftLayer.CLI.subnet.route:cli'),
326327

327328
('tags', 'SoftLayer.CLI.tags'),
328329
('tags:cleanup', 'SoftLayer.CLI.tags.cleanup:cli'),

0 commit comments

Comments
 (0)