Fix app list in package to be string

This commit is contained in:
José Armando García Sancio
2015-05-29 07:54:26 -07:00
parent fa9c6625ee
commit 8e801406bf
3 changed files with 8 additions and 15 deletions

View File

@@ -386,7 +386,7 @@ def _list(endpoints, app_id, package_name):
# if the user is asking a specific id then only show that id
pkg_info['apps'] = [
app for app in pkg_info['apps']
if app['appId'] == app_id
if app == app_id
]
results.append(pkg_info)
@@ -421,7 +421,7 @@ def _matches_app_id(app_id, pkg_info):
:rtype: bool
"""
return app_id is None or {'appId': app_id} in pkg_info.get('apps')
return app_id is None or app_id in pkg_info.get('apps')
def _search(query):

View File

@@ -25,7 +25,8 @@ def _chronos_description(app_ids):
"""
result = [
{"description": "A fault tolerant job scheduler for Mesos which "
{"apps": app_ids,
"description": "A fault tolerant job scheduler for Mesos which "
"handles dependencies and ISO8601 based schedules.",
"framework": True,
"images": {
@@ -67,8 +68,6 @@ version-1.x.zip",
"version": "2.3.4"
}]
result[0]['apps'] = [{'appId': app_id} for app_id in app_ids]
return (json.dumps(result, sort_keys=True, indent=2).replace(' \n', '\n') +
'\n').encode('utf-8')
@@ -509,9 +508,7 @@ def test_uninstall_cli():
stdout = b"""[
{
"apps": [
{
"appId": "/helloworld"
}
"/helloworld"
],
"description": "Example DCOS application package",
"maintainer": "support@mesosphere.io",
@@ -602,9 +599,7 @@ def test_list_installed_cli():
[
{
"apps": [
{
"appId": "/helloworld"
}
"/helloworld"
],
"command": {
"name": "helloworld"

View File

@@ -311,7 +311,7 @@ class InstalledPackage(object):
ret['command'] = {'name': self.subcommand.name}
if self.apps:
ret['apps'] = [{'appId': app['appId']} for app in self.apps]
ret['apps'] = [app['appId'] for app in self.apps]
if self.subcommand:
package_json = self.subcommand.package_json()
@@ -330,9 +330,7 @@ def installed_packages(init_client, endpoints):
"""Returns all installed packages in the format:
[{
'apps': [{
'appId': <id>
}],
'apps': [<id>],
'command': {
'name': <name>
}