update code/docs to reflect command.json being unconfigurable (#598)

This commit is contained in:
tamarrow
2016-04-29 11:13:20 -07:00
parent 75a30df554
commit 03541a8eb8
5 changed files with 12 additions and 35 deletions

View File

@@ -56,8 +56,7 @@ Options:
--cli
Command line only.
--config
Print the the configurable properties for the `marathon.json` and
`command.json` files.
Print the the configurable properties for the `marathon.json` file.
--index=<index>
The numerical position in the package repository list. Package
repositories are searched in descending order. By default the Universe
@@ -73,9 +72,8 @@ Options:
--package-versions
Print all versions for this package.
--render
Collate the marathon.json or command.json package templates with the
values from config.json and --options. If not provided, print the raw
templates.
Collate the marathon.json package template with the values from
config.json and --options. If not provided, print the raw templates.
--version
Print version information.
--yes

View File

@@ -229,8 +229,7 @@ def _describe(package_name,
:param options_path: Path to json file with options to override
config.json defaults.
:type options_path: str
:param render: If True, marathon.json and/or command.json templates
will be rendered
:param render: If True, marathon.json will be rendered
:type render: boolean
:param package_versions: If True, a list of all package versions will
be printed
@@ -273,11 +272,7 @@ def _describe(package_name,
options = pkg.options(user_options)
if cli:
if render:
cli_output = pkg.command_json(options)
else:
cli_output = pkg.command_template()
emitter.publish(cli_output)
emitter.publish(pkg.command_json())
if app:
if render:
app_output = pkg.marathon_json(options)

View File

@@ -56,8 +56,7 @@ Options:
--cli
Command line only.
--config
Print the the configurable properties for the `marathon.json` and
`command.json` files.
Print the the configurable properties for the `marathon.json` file.
--index=<index>
The numerical position in the package repository list. Package
repositories are searched in descending order. By default the Universe
@@ -73,9 +72,8 @@ Options:
--package-versions
Print all versions for this package.
--render
Collate the marathon.json or command.json package templates with the
values from config.json and --options. If not provided, print the raw
templates.
Collate the marathon.json package template with the values from
config.json and --options. If not provided, print the raw templates.
--version
Print version information.
--yes

View File

@@ -1,8 +1,6 @@
import collections
import functools
import json
import pystache
import six
from dcos import emitting, http, util
from dcos.errors import (DCOSAuthenticationException,
@@ -365,14 +363,6 @@ class CosmosPackageVersion():
return self._resource_json
def command_template(self):
""" Returns raw data from command.json
:returns: raw data from command.json
:rtype: str
"""
return self._command_json
def marathon_template(self):
"""Returns raw data from marathon.json
@@ -424,18 +414,14 @@ class CosmosPackageVersion():
return self._command_json is not None
def command_json(self, options):
"""Returns the JSON content of the command.json template, after
rendering it with options.
def command_json(self):
"""Returns the JSON content of the command.json file.
:param options: the template options to use in rendering
:type options: dict
:returns: Package data
:rtype: dict
"""
rendered = pystache.render(json.dumps(self._command_json), options)
return util.load_jsons(rendered)
return self._command_json
def package_versions(self):
"""Returns a list of available versions for this package

View File

@@ -231,7 +231,7 @@ def _install_env(pkg, options):
pkg_dir = _package_dir(pkg.name())
install_operation = pkg.command_json(options)
install_operation = pkg.command_json()
env_dir = os.path.join(pkg_dir,
constants.DCOS_SUBCOMMAND_VIRTUALENV_SUBDIR)