Skip to content

Commit ec4bdf2

Browse files
caberoscaberos
authored andcommitted
fix the merge conflict
2 parents 9822e01 + ddb1c2e commit ec4bdf2

File tree

20 files changed

+154
-30
lines changed

20 files changed

+154
-30
lines changed

CHANGELOG.md

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

3+
## [6.1.6] - 2023-03-27
4+
5+
From now on changes will be published only on GitHub https://github.com/softlayer/softlayer-python/releases
6+
7+
38
## [6.1.3] - 2022-11-30
49

510
#### What's Changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
"""Delete a provisioning script"""
2+
# :license: MIT, see LICENSE for more details.
3+
4+
import click
5+
import SoftLayer
6+
7+
from SoftLayer.CLI.command import SLCommand as SLCommand
8+
from SoftLayer.CLI import environment
9+
from SoftLayer.managers.account import AccountManager as AccountManager
10+
11+
12+
@click.command(cls=SLCommand)
13+
@click.argument('identifier')
14+
@environment.pass_env
15+
def cli(env, identifier):
16+
"""Delete a provisioning script"""
17+
18+
manager = AccountManager(env.client)
19+
20+
try:
21+
manager.delete_provisioning(identifier)
22+
click.secho("%s deleted successfully" % identifier, fg='green')
23+
except SoftLayer.SoftLayerAPIError as ex:
24+
click.secho("Failed to delete %s\n%s" % (identifier, ex), fg='red')

SoftLayer/CLI/cdn/delete.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
"""Delete a CDN domain mapping."""
2+
# :license: MIT, see LICENSE for more details.
3+
4+
import click
5+
6+
import SoftLayer
7+
from SoftLayer.CLI import environment
8+
9+
10+
@click.command(cls=SoftLayer.CLI.command.SLCommand, )
11+
@click.argument('unique_id')
12+
@environment.pass_env
13+
def cli(env, unique_id):
14+
"""Delete a CDN domain mapping."""
15+
16+
manager = SoftLayer.CDNManager(env.client)
17+
18+
cdn = manager.delete_cdn(unique_id)
19+
20+
if cdn:
21+
env.fout("Cdn with uniqueId: {} was deleted.".format(unique_id))

SoftLayer/CLI/event_log/get.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import SoftLayer
77
from SoftLayer.CLI import environment
8+
from SoftLayer.CLI import exceptions
89
from SoftLayer import utils
910

1011

@@ -56,8 +57,11 @@ def cli(env, date_min, date_max, obj_event, obj_id, obj_type, utc_offset, metada
5657
if user == "CUSTOMER":
5758
username = user_data.get(log['userId'])
5859
if username is None:
59-
username = user_mgr.get_user(log['userId'], "mask[username]")['username']
60-
user_data[log['userId']] = username
60+
try:
61+
username = user_mgr.get_user(log['userId'], "mask[username]")['username']
62+
user_data[log['userId']] = username
63+
except exceptions.SoftLayerAPIError:
64+
username = log['userId']
6165
user = username
6266

6367
if metadata:

SoftLayer/CLI/hardware/create_credential.py

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,44 +14,37 @@
1414
@click.option('--username', '-U', required=True, help="The username part of the username/password pair")
1515
@click.option('--password', '-P', required=True, help="The password part of the username/password pair.")
1616
@click.option('--notes', '-n', help="A note string stored for this username/password pair.")
17-
@click.option('--system', required=True, help="The name of this specific piece of software.")
17+
@click.option('--software', required=True, help="The name of this specific piece of software.")
1818
@environment.pass_env
19-
def cli(env, identifier, username, password, notes, system):
19+
def cli(env, identifier, username, password, notes, software):
2020
"""Create a password for a software component."""
2121

2222
mgr = SoftLayer.HardwareManager(env.client)
2323

24-
software = mgr.get_software_components(identifier)
25-
sw_id = ''
24+
software_components = mgr.get_software_components(identifier)
25+
software_id = ''
2626
try:
27-
for sw_instance in software:
28-
if (sw_instance['softwareLicense']['softwareDescription']['name']).lower() == system:
29-
sw_id = sw_instance['id']
27+
for software_component in software_components:
28+
if software_component['softwareLicense']['softwareDescription']['name'].lower() == software.lower():
29+
software_id = software_component['id']
3030
except KeyError as ex:
31-
raise exceptions.CLIAbort('System id not found') from ex
31+
raise exceptions.CLIAbort('Software not found') from ex
3232

3333
template = {
3434
"notes": notes,
3535
"password": password,
36-
"softwareId": sw_id,
37-
"username": username,
38-
"software": {
39-
"hardwareId": identifier,
40-
"softwareLicense": {
41-
"softwareDescription": {
42-
"name": system
43-
}
44-
}
45-
}}
36+
"softwareId": software_id,
37+
"username": username
38+
}
4639

4740
result = mgr.create_credential(template)
4841

49-
table = formatting.KeyValueTable(['name', 'value'])
50-
table.align['name'] = 'r'
51-
table.align['value'] = 'l'
52-
table.add_row(['Software Id', result['id']])
42+
table = formatting.KeyValueTable(['Name', 'Value'])
43+
table.align['Name'] = 'r'
44+
table.align['Value'] = 'l'
45+
table.add_row(['Software Credential Id', result['id']])
5346
table.add_row(['Created', result['createDate']])
5447
table.add_row(['Username', result['username']])
5548
table.add_row(['Password', result['password']])
56-
table.add_row(['Notes', result['notes']])
49+
table.add_row(['Notes', result.get('notes') or formatting.blank()])
5750
env.fout(table)

SoftLayer/CLI/routes.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
('account:bandwidth-pools', 'SoftLayer.CLI.account.bandwidth_pools:cli'),
2727
('account:hooks', 'SoftLayer.CLI.account.hooks:cli'),
2828
('account:hook-create', 'SoftLayer.CLI.account.hook_create:cli'),
29+
('account:hook-delete', 'SoftLayer.CLI.account.hook_delete:cli'),
2930

3031
('virtual', 'SoftLayer.CLI.virt'),
3132
('virtual:bandwidth', 'SoftLayer.CLI.virt.bandwidth:cli'),
@@ -80,6 +81,7 @@
8081
('cdn:origin-list', 'SoftLayer.CLI.cdn.origin_list:cli'),
8182
('cdn:origin-remove', 'SoftLayer.CLI.cdn.origin_remove:cli'),
8283
('cdn:purge', 'SoftLayer.CLI.cdn.purge:cli'),
84+
('cdn:delete', 'SoftLayer.CLI.cdn.delete:cli'),
8385

8486
('config', 'SoftLayer.CLI.config'),
8587
('config:setup', 'SoftLayer.CLI.config.setup:cli'),

SoftLayer/consts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
:license: MIT, see LICENSE for more details.
77
"""
8-
VERSION = 'v6.1.5'
8+
VERSION = 'v6.1.6'
99
API_PUBLIC_ENDPOINT = 'https://api.softlayer.com/xmlrpc/v3.1/'
1010
API_PRIVATE_ENDPOINT = 'https://api.service.softlayer.com/xmlrpc/v3.1/'
1111
API_PUBLIC_ENDPOINT_REST = 'https://api.softlayer.com/rest/v3.1/'

SoftLayer/fixtures/SoftLayer_Network_CdnMarketplace_Configuration_Mapping.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,27 @@
5050
"cacheKeyQueryRule": "include: test"
5151
}
5252
]
53+
54+
deleteDomainMapping = [
55+
{
56+
"akamaiCname": "wildcard.appdomain.mdc.edgekey.net",
57+
"certificateType": "NO_CERT",
58+
"cname": "cdnakayq9fye4t88239.cdn.appdomain.cloud",
59+
"createDate": "2023-03-29T07:33:42-06:00",
60+
"domain": "www.test.com",
61+
"header": "www.header.com",
62+
"httpPort": 80,
63+
"httpsPort": None,
64+
"modifyDate": "2023-03-29T07:33:46-06:00",
65+
"originHost": "67.228.227.82",
66+
"originType": "HOST_SERVER",
67+
"path": "/path/*",
68+
"performanceConfiguration": "General web delivery",
69+
"protocol": "HTTP",
70+
"respectHeaders": False,
71+
"serveStale": True,
72+
"status": "DELETING",
73+
"uniqueId": "303727924488685",
74+
"vendorName": "akamai"
75+
}
76+
]

SoftLayer/fixtures/SoftLayer_Provisioning_Hook.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
'uri': 'http://slclitest.com',
66
'hookType': {}
77
}
8+
deleteObject = True

SoftLayer/managers/account.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,15 @@ def create_provisioning(self, name, uri):
408408
}
409409
return self.client.call('SoftLayer_Provisioning_Hook', 'createObject', template)
410410

411+
def delete_provisioning(self, identifier):
412+
"""Delete a provisioning script
413+
414+
param: identifier provisioning script identifier
415+
416+
Returns: boolean
417+
"""
418+
return self.client.call("SoftLayer_Provisioning_Hook", "deleteObject", id=identifier)
419+
411420
def get_account_upgrade_orders(self, limit=100):
412421
"""Gets upgrade order list"""
413422
return self.client.call('SoftLayer_Account', 'getUpgradeRequests', limit=limit)

0 commit comments

Comments
 (0)