Skip to content

Commit d9dd77d

Browse files
Merge pull request #1726 from edsonarios/issue1722
Fix bug with command - slcli cdn edit
2 parents 96d50fc + e04dcca commit d9dd77d

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

SoftLayer/CLI/cdn/edit.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
type=click.INT,
2020
help="HTTP port."
2121
)
22+
@click.option('--https-port', '-s',
23+
type=click.INT,
24+
help="HTTPS port."
25+
)
2226
@click.option('--origin', '-o',
2327
type=click.STRING,
2428
help="Origin server address."
@@ -39,7 +43,7 @@
3943
"the Dynamic content acceleration option is not added because this has a special configuration."
4044
)
4145
@environment.pass_env
42-
def cli(env, identifier, header, http_port, origin, respect_headers, cache, performance_configuration):
46+
def cli(env, identifier, header, http_port, https_port, origin, respect_headers, cache, performance_configuration):
4347
"""Edit a CDN Account.
4448
4549
Note: You can use the hostname or uniqueId as IDENTIFIER.
@@ -56,7 +60,7 @@ def cli(env, identifier, header, http_port, origin, respect_headers, cache, perf
5660
else:
5761
cache_result['cacheKeyQueryRule'] = cache[0]
5862

59-
cdn_result = manager.edit(cdn_id, header=header, http_port=http_port, origin=origin,
63+
cdn_result = manager.edit(cdn_id, header=header, http_port=http_port, https_port=https_port, origin=origin,
6064
respect_headers=respect_headers, cache=cache_result,
6165
performance_configuration=performance_configuration)
6266

@@ -67,7 +71,10 @@ def cli(env, identifier, header, http_port, origin, respect_headers, cache, perf
6771
for cdn in cdn_result:
6872
table.add_row(['Create Date', cdn.get('createDate')])
6973
table.add_row(['Header', cdn.get('header')])
70-
table.add_row(['Http Port', cdn.get('httpPort')])
74+
if cdn.get('httpPort'):
75+
table.add_row(['Http Port', cdn.get('httpPort')])
76+
if cdn.get('httpsPort'):
77+
table.add_row(['Https Port', cdn.get('httpsPort')])
7178
table.add_row(['Origin Type', cdn.get('originType')])
7279
table.add_row(['Performance Configuration', cdn.get('performanceConfiguration')])
7380
table.add_row(['Protocol', cdn.get('protocol')])

SoftLayer/managers/cdn.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,14 @@ def end_date(self):
175175
"""Retrieve the cdn usage metric end date."""
176176
return self._end_date
177177

178-
def edit(self, identifier, header=None, http_port=None, origin=None,
178+
def edit(self, identifier, header=None, http_port=None, https_port=None, origin=None,
179179
respect_headers=None, cache=None, performance_configuration=None):
180180
"""Edit the cdn object.
181181
182182
:param string identifier: The CDN identifier.
183183
:param header: The cdn Host header.
184184
:param http_port: The cdn HTTP port.
185+
:param https_port: The cdn HTTPS port.
185186
:param origin: The cdn Origin server address.
186187
:param respect_headers: The cdn Respect headers.
187188
:param cache: The cdn Cache key optimization.
@@ -199,17 +200,24 @@ def edit(self, identifier, header=None, http_port=None, origin=None,
199200
'vendorName': cdn_instance_detail.get('vendorName'),
200201
'cname': cdn_instance_detail.get('cname'),
201202
'domain': cdn_instance_detail.get('domain'),
202-
'httpPort': cdn_instance_detail.get('httpPort'),
203203
'origin': cdn_instance_detail.get('originHost'),
204204
'header': cdn_instance_detail.get('header')
205205
}
206+
if cdn_instance_detail.get('httpPort'):
207+
config['httpPort'] = cdn_instance_detail.get('httpPort')
208+
209+
if cdn_instance_detail.get('httpsPort'):
210+
config['httpsPort'] = cdn_instance_detail.get('httpsPort')
206211

207212
if header:
208213
config['header'] = header
209214

210215
if http_port:
211216
config['httpPort'] = http_port
212217

218+
if https_port:
219+
config['httpsPort'] = https_port
220+
213221
if origin:
214222
config['origin'] = origin
215223

0 commit comments

Comments
 (0)