Skip to content

Commit bf1a73d

Browse files
Merge pull request softlayer#1543 from allmightyspiff/issues1540
Forces specific endoing on XMLRPC requests
2 parents f6a8d6c + dcbc9fe commit bf1a73d

26 files changed

Lines changed: 124 additions & 83 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/upgrade.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def cli(env, identifier, memory, network, drive_controller, public_bandwidth, ad
5151
"This action will incur charges on your account. Continue?")):
5252
raise exceptions.CLIAbort('Aborted')
5353

54-
disk_list = list()
54+
disk_list = []
5555
if add_disk:
5656
for guest_disk in add_disk:
5757
disks = {'description': 'add_disk', 'capacity': guest_disk[0], 'number': guest_disk[1]}

0 commit comments

Comments
 (0)