Merge pull request #393 from mesosphere/dcos-4138

dcos-4138 add images property from resource.json in install
This commit is contained in:
José Armando García Sancio
2015-12-29 10:01:12 -08:00
2 changed files with 31 additions and 2 deletions

View File

@@ -1,3 +1,4 @@
import base64
import contextlib
import json
import os
@@ -10,8 +11,9 @@ from dcos.errors import DCOSException
import pytest
from mock import patch
from .common import (assert_command, assert_lines, delete_zk_nodes,
exec_command, file_bytes, file_json, get_services,
from .common import (assert_command, assert_lines, delete_zk_node,
delete_zk_nodes, exec_command, file_bytes, file_json,
get_services, package_install, package_uninstall,
service_shutdown, wait_for_service, watch_all_deployments)
@@ -374,6 +376,29 @@ cli-test-3.zip"""
_uninstall_helloworld()
def test_images_in_metadata():
package_install('cassandra')
labels = _get_app_labels('/cassandra/dcos')
dcos_package_metadata = labels.get("DCOS_PACKAGE_METADATA")
images = json.loads(
base64.b64decode(dcos_package_metadata).decode('utf-8'))["images"]
assert images.get("icon-small") is not None
assert images.get("icon-medium") is not None
assert images.get("icon-large") is not None
# uninstall
stderr = (b'Uninstalled package [cassandra] version [0.2.0-1]\n'
b'The Apache Cassandra DCOS Service has been uninstalled and '
b'will no longer run.\n'
b'Please follow the instructions at http://docs.mesosphere.com/'
b'services/cassandra/#uninstall to clean up any persisted '
b'state\n')
package_uninstall('cassandra', stderr=stderr)
assert_command(['dcos', 'marathon', 'group', 'remove', '/cassandra'])
delete_zk_node('cassandra-mesos')
def test_install_with_id(zk_znode):
args = ['--app-id=chronos-1', '--yes']
stdout = (b'Installing Marathon app for package [chronos] version [2.4.0] '

View File

@@ -81,6 +81,10 @@ def _make_package_labels(pkg, revision, options):
"""
metadata = pkg.package_json(revision)
# add images to package.json metadata for backwards compatability in the UI
if pkg._has_resource_definition(revision):
images = {"images": pkg._resource_json(revision)["images"]}
metadata.update(images)
encoded_metadata = _base64_encode(metadata)