Skip to content

Commit 39686b5

Browse files
caberoscaberos
authored andcommitted
update the branch and fix the team code review comments
2 parents 9317fe3 + bf1a73d commit 39686b5

27 files changed

Lines changed: 132 additions & 91 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Autoscale"""

SoftLayer/CLI/autoscale/edit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def cli(env, identifier, name, minimum, maximum, userdata, userfile, cpu, memory
3232
if userdata:
3333
virt_template['userData'] = [{"value": userdata}]
3434
elif userfile:
35-
with open(userfile, 'r') as userfile_obj:
35+
with open(userfile, 'r', encoding="utf-8") as userfile_obj:
3636
virt_template['userData'] = [{"value": userfile_obj.read()}]
3737
virt_template['startCpus'] = cpu
3838
virt_template['maxMemory'] = memory

SoftLayer/CLI/block/count.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def cli(env, sortby, datacenter):
2525
mask=mask)
2626

2727
# cycle through all block volumes and count datacenter occurences.
28-
datacenters = dict()
28+
datacenters = {}
2929
for volume in block_volumes:
3030
service_resource = volume['serviceResource']
3131
if 'datacenter' in service_resource:

SoftLayer/CLI/block/replication/partners.py

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,10 @@
66
from SoftLayer.CLI import columns as column_helper
77
from SoftLayer.CLI import environment
88
from SoftLayer.CLI import formatting
9+
from SoftLayer.CLI import storage_utils
910

10-
COLUMNS = [
11-
column_helper.Column('ID', ('id',)),
12-
column_helper.Column('Username', ('username',), mask="username"),
13-
column_helper.Column('Account ID', ('accountId',), mask="accountId"),
14-
column_helper.Column('Capacity (GB)', ('capacityGb',), mask="capacityGb"),
15-
column_helper.Column('Hardware ID', ('hardwareId',), mask="hardwareId"),
16-
column_helper.Column('Guest ID', ('guestId',), mask="guestId"),
17-
column_helper.Column('Host ID', ('hostId',), mask="hostId"),
18-
]
19-
20-
DEFAULT_COLUMNS = [
21-
'ID',
22-
'Username',
23-
'Account ID',
24-
'Capacity (GB)',
25-
'Hardware ID',
26-
'Guest ID',
27-
'Host ID'
28-
]
11+
COLUMNS = storage_utils.REPLICATION_PARTNER_COLUMNS
12+
DEFAULT_COLUMNS = storage_utils.REPLICATION_PARTNER_DEFAULT
2913

3014

3115
@click.command()

SoftLayer/CLI/dns/zone_import.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def cli(env, zonefile, dry_run):
2626
"""Import zone based off a BIND zone file."""
2727

2828
manager = SoftLayer.DNSManager(env.client)
29-
with open(zonefile) as zone_f:
29+
with open(zonefile, encoding="utf-8") as zone_f:
3030
zone_contents = zone_f.read()
3131

3232
zone, records, bad_lines = parse_zone_details(zone_contents)

SoftLayer/CLI/file/count.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def cli(env, sortby, datacenter):
2424
file_volumes = file_manager.list_file_volumes(datacenter=datacenter,
2525
mask=mask)
2626

27-
datacenters = dict()
27+
datacenters = {}
2828
for volume in file_volumes:
2929
service_resource = volume['serviceResource']
3030
if 'datacenter' in service_resource:

SoftLayer/CLI/file/replication/partners.py

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,10 @@
66
from SoftLayer.CLI import columns as column_helper
77
from SoftLayer.CLI import environment
88
from SoftLayer.CLI import formatting
9+
from SoftLayer.CLI import storage_utils
910

10-
COLUMNS = [
11-
column_helper.Column('ID', ('id',)),
12-
column_helper.Column('Username', ('username',), mask="username"),
13-
column_helper.Column('Account ID', ('accountId',), mask="accountId"),
14-
column_helper.Column('Capacity (GB)', ('capacityGb',), mask="capacityGb"),
15-
column_helper.Column('Hardware ID', ('hardwareId',), mask="hardwareId"),
16-
column_helper.Column('Guest ID', ('guestId',), mask="guestId"),
17-
column_helper.Column('Host ID', ('hostId',), mask="hostId"),
18-
]
19-
20-
# In-line comment to avoid similarity flag with block version
21-
22-
DEFAULT_COLUMNS = [
23-
'ID',
24-
'Username',
25-
'Account ID',
26-
'Capacity (GB)',
27-
'Hardware ID',
28-
'Guest ID',
29-
'Host ID'
30-
]
11+
COLUMNS = storage_utils.REPLICATION_PARTNER_COLUMNS
12+
DEFAULT_COLUMNS = storage_utils.REPLICATION_PARTNER_DEFAULT
3113

3214

3315
@click.command()

SoftLayer/CLI/firewall/edit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def parse_rules(content=None):
2323
:returns: a list of rules
2424
"""
2525
rules = content.split(DELIMITER)
26-
parsed_rules = list()
26+
parsed_rules = []
2727
order = 1
2828
for rule in rules:
2929
if rule.strip() == '':

SoftLayer/CLI/hardware/edit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def cli(env, identifier, domain, userfile, tag, hostname, userdata, public_speed
4040
if userdata:
4141
data['userdata'] = userdata
4242
elif userfile:
43-
with open(userfile, 'r') as userfile_obj:
43+
with open(userfile, 'r', encoding="utf-8") as userfile_obj:
4444
data['userdata'] = userfile_obj.read()
4545

4646
if tag:

SoftLayer/CLI/hardware/sensor.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@ def cli(env, identifier, discrete):
1616
mgr = SoftLayer.HardwareManager(env.client)
1717
sensors = mgr.get_sensors(identifier)
1818

19-
temperature_table = formatting.Table(["sensor", "status", "Reading", "min", "Max"],
20-
title='temperature Degree c')
19+
temperature_table = formatting.Table(["Sensor", "Status", "Reading", "Min", "Max"],
20+
title='Temperature (c)')
2121

22-
volts_table = formatting.Table(["sensor", "status", "Reading", "min", "Max"],
23-
title='volts')
22+
volts_table = formatting.Table(["Sensor", "Status", "Reading", "Min", "Max"],
23+
title='Volts')
2424

25-
watts_table = formatting.Table(["sensor", "status", "Reading"],
25+
watts_table = formatting.Table(["Sensor", "Status", "Reading"],
2626
title='Watts')
2727

28-
rpm_table = formatting.Table(["sensor", "status", "Reading", "min"],
28+
rpm_table = formatting.Table(["Sensor", "Status", "Reading", "Min"],
2929
title='RPM')
3030

31-
discrete_table = formatting.Table(["sensor", "status", "Reading"],
32-
title='discrete')
31+
discrete_table = formatting.Table(["Sensor", "Status", "Reading"],
32+
title='Discrete')
3333

3434
for sensor in sensors:
3535
if sensor.get('sensorUnits') == 'degrees C':

0 commit comments

Comments
 (0)