Skip to content

Commit 2e0eb69

Browse files
author
Gabriel Monroy
committed
add formations:update to set domain used in multi-app
1 parent 318d9b4 commit 2e0eb69

1 file changed

Lines changed: 23 additions & 4 deletions

File tree

client/deis.py

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,7 @@ def formations(self, args):
889889
Valid commands for formations:
890890
891891
formations:create create a new container formation from scratch
892+
formations:update update formation fields including domain
892893
formations:info print a represenation of the formation
893894
formations:converge force-converge all nodes in the formation
894895
formations:calculate recalculate and update the formation databag
@@ -1000,15 +1001,14 @@ def formations_info(self, args):
10001001
"""
10011002
Print info about a formation
10021003
1003-
Usage: deis formations:info
1004+
Usage: deis formations:info <id>
10041005
"""
1005-
formation = args.get('<formation>')
1006-
if not formation:
1007-
formation = self._session.formation
1006+
formation = args.get('<id>')
10081007
response = self._dispatch('get', "/api/formations/{}".format(formation))
10091008
if response.status_code == requests.codes.ok: # @UndefinedVariable
10101009
data = response.json()
10111010
print("=== {} Formation".format(formation))
1011+
print(json.dumps(response.json(), indent=2))
10121012
print()
10131013
args = {'<formation>': data['id']}
10141014
self.layers_list(args)
@@ -1070,6 +1070,25 @@ def formations_destroy(self, args):
10701070
else:
10711071
raise ResponseError(response)
10721072

1073+
def formations_update(self, args):
1074+
"""
1075+
Update formation fields
1076+
1077+
This is typically used to add a "domain" to to host
1078+
multiple applications on a single formation
1079+
1080+
Usage: deis formations:update <id> [--domain=<domain>]
1081+
"""
1082+
formation = args['<id>']
1083+
domain = args.get('--domain')
1084+
body = {'domain': domain}
1085+
response = self._dispatch('patch', '/api/formations/{}'.format(formation),
1086+
json.dumps(body))
1087+
if response.status_code == requests.codes.ok: # @UndefinedVariable
1088+
print(json.dumps(response.json(), indent=2))
1089+
else:
1090+
raise ResponseError(response)
1091+
10731092
def keys(self, args):
10741093
"""
10751094
Valid commands for SSH keys:

0 commit comments

Comments
 (0)