Skip to content

Commit 5703672

Browse files
committed
fix(client) : add sshkey encode in client update api call
1 parent b14228b commit 5703672

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
@@ -920,9 +920,18 @@ def clusters_update(self, args):
920920
body = {}
921921
for k, arg in (('domain', '--domain'), ('hosts', '--hosts'),
922922
('auth', '--auth'), ('type', '--type')):
923-
v = args.get(arg)
924-
if v:
925-
body.update({k: v})
923+
if k == 'auth' :
924+
auth_path = os.path.expanduser(args['--auth'])
925+
if not os.path.exists(auth_path):
926+
print('Path to authentication credentials does not exist: {}'.format(auth_path))
927+
sys.exit(1)
928+
with open(auth_path) as f:
929+
data = f.read()
930+
body.update({'auth': base64.b64encode(data)})
931+
else :
932+
v = args.get(arg)
933+
if v:
934+
body.update({k: v})
926935
response = self._dispatch('patch', '/api/clusters/{}'.format(cluster),
927936
json.dumps(body))
928937
if response.status_code == requests.codes.ok: # @UndefinedVariable

0 commit comments

Comments
 (0)