Skip to content

Commit 7997ae1

Browse files
a few updates to make this islcli work out of the box
1 parent 323e6ba commit 7997ae1

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

SoftLayer/API.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def employee_client(username=None,
154154
proxy=None,
155155
user_agent=None,
156156
transport=None,
157-
verify=True):
157+
verify=False):
158158
"""Creates an INTERNAL SoftLayer API client using your environment.
159159
160160
Settings are loaded via keyword arguments, environemtal variables and
@@ -187,6 +187,7 @@ def employee_client(username=None,
187187
'Your Company'
188188
189189
"""
190+
# SSL verification is OFF because internal api uses a self signed cert
190191
settings = config.get_client_settings(username=username,
191192
api_key=None,
192193
endpoint_url=endpoint_url,
@@ -381,6 +382,7 @@ def call(self, service, method, *args, **kwargs):
381382
request.filter = kwargs.get('filter')
382383
request.limit = kwargs.get('limit')
383384
request.offset = kwargs.get('offset')
385+
request.url = self.settings['softlayer'].get('endpoint_url')
384386
if kwargs.get('verify') is not None:
385387
request.verify = kwargs.get('verify')
386388

SoftLayer/CLI/login.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from SoftLayer.API import EmployeeClient
99
from SoftLayer.CLI.command import SLCommand as SLCommand
1010
from SoftLayer import config
11+
from SoftLayer import consts
1112
from SoftLayer.CLI import environment
1213

1314

SoftLayer/auth.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,14 @@ def __init__(self, user_id, user_hash):
151151

152152
def get_request(self, request):
153153
"""Sets token-based auth headers."""
154-
request.headers['employeesession'] = {
155-
'userId': self.user_id,
156-
'authToken': self.hash,
157-
}
154+
if 'xml' in request.url:
155+
request.headers['employeesession'] = {
156+
'userId': self.user_id,
157+
'authToken': self.hash,
158+
}
159+
else:
160+
request.transport_user = self.user_id
161+
request.transport_password = self.hash
158162
return request
159163

160164
def __repr__(self):

SoftLayer/consts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
API_PRIVATE_ENDPOINT = 'https://api.service.softlayer.com/xmlrpc/v3.1/'
1111
API_PUBLIC_ENDPOINT_REST = 'https://api.softlayer.com/rest/v3.1/'
1212
API_PRIVATE_ENDPOINT_REST = 'https://api.service.softlayer.com/rest/v3.1/'
13-
API_EMPLOYEE_ENDPOINT = 'https://internal.app0lb.dal10.softlayer.local/v3/internal/xmlrpc/'
13+
API_EMPLOYEE_ENDPOINT = 'https://internal.applb.dal10.softlayer.local/v3/internal/xmlrpc/'
1414
USER_AGENT = "softlayer-python/%s" % VERSION
1515
CONFIG_FILE = "~/.softlayer"

0 commit comments

Comments
 (0)