Skip to content

Commit d451d17

Browse files
committed
Merge pull request #1283 from smothiki/clientfix
fix(client) : add sshkey encode in client update api call
2 parents 590499e + 5703672 commit d451d17

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

client/deis.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -937,9 +937,18 @@ def clusters_update(self, args):
937937
body = {}
938938
for k, arg in (('domain', '--domain'), ('hosts', '--hosts'),
939939
('auth', '--auth'), ('type', '--type')):
940-
v = args.get(arg)
941-
if v:
942-
body.update({k: v})
940+
if k == 'auth' :
941+
auth_path = os.path.expanduser(args['--auth'])
942+
if not os.path.exists(auth_path):
943+
print('Path to authentication credentials does not exist: {}'.format(auth_path))
944+
sys.exit(1)
945+
with open(auth_path) as f:
946+
data = f.read()
947+
body.update({'auth': base64.b64encode(data)})
948+
else :
949+
v = args.get(arg)
950+
if v:
951+
body.update({k: v})
943952
response = self._dispatch('patch', '/api/clusters/{}'.format(cluster),
944953
json.dumps(body))
945954
if response.status_code == requests.codes.ok: # @UndefinedVariable

0 commit comments

Comments
 (0)