Updating app domain model to contain scale_config

Updating the app domain model object with a field to
contain the scale_config information. This can be used
in the cli to display the target number of instances
that may have been requested using 'app scale' command.

Change-Id: If3e214064e107726ebbe1040ffee35a84ed32971
Closes-Bug: #1545836
This commit is contained in:
Devdatta Kulkarni 2016-02-15 13:53:33 -06:00
parent c80e5fae56
commit 01297c64c8
2 changed files with 7 additions and 3 deletions

View File

@ -58,6 +58,9 @@ class App(api_types.Base):
repo_token = wtypes.text
created_at = datetime.datetime
raw_content = wtypes.text
scale_config = wtypes.DictType(
wtypes.text,
wtypes.DictType(wtypes.text, wtypes.text))
parameters = wtypes.DictType(
wtypes.text,
@ -80,6 +83,7 @@ class App(api_types.Base):
@classmethod
def from_db_model(cls, m, host_url):
json = m.as_dict()
json['type'] = m.__tablename__
json['uri'] = '%s/v1/apps/%s' % (host_url, m.id)
@ -101,7 +105,7 @@ class App(api_types.Base):
'trigger_actions',
'workflow_config',
'stack_id',
'raw_content',
'raw_content'
]
base = super(App, self).as_dict(db_model)

View File

@ -80,11 +80,11 @@ class WorkflowHandler(handler.Handler):
current_config = app.scale_config
if current_config:
current_config[app.name]['target'] = target
current_config[app.name]['target'] = str(target)
scale_config['scale_config'] = current_config
else:
config_data = dict()
config_data['target'] = target
config_data['target'] = str(target)
app_scale_config = dict()
app_scale_config[app.name] = config_data
scale_config = dict()