Merge pull request #117 from mesosphere/core

enable core.* config vars -- DCOS-1049
This commit is contained in:
mgummelt
2015-04-17 12:46:37 -07:00
4 changed files with 45 additions and 1 deletions

View File

@@ -22,10 +22,12 @@ Positional Arguments:
"""
import collections
import json
import os
import dcoscli
import docopt
import pkg_resources
import six
import toml
from dcos.api import (cmds, config, constants, emitting, errors, jsonitem,
@@ -327,6 +329,16 @@ def _get_config_schema(command):
:rtype: (dict, dcos.api.errors.Error)
"""
# core.* config variables are special. They're valid, but don't
# correspond to any particular subcommand, so we must handle them
# separately.
if command == "core":
return (json.loads(
pkg_resources.resource_string(
'dcoscli',
'data/config-schema/core.json').decode('utf-8')),
None)
executable, err = subcommand.command_executables(
command,
util.dcos_path())

View File

@@ -0,0 +1,23 @@
{
"$schema": "http://json-schema.org/schema#",
"type": "object",
"properties": {
"reporting": {
"type": "boolean",
"title": "Usage Reporting",
"description": "Whether to report usage events to Mesosphere",
"default": true
},
"email": {
"type": "string",
"title": "Your email address",
"description": "Your email address"
},
"token": {
"type": "string",
"title": "Your OAuth token",
"description": "Your OAuth token"
}
},
"additionalProperties": false
}

View File

@@ -1,3 +1,5 @@
[core]
reporting = true
[subcommand]
pip_find_links = "../dist"
[marathon]

View File

@@ -67,7 +67,8 @@ def test_list_property(env):
env)
assert returncode == 0
assert stdout == b"""marathon.host=localhost
assert stdout == b"""core.reporting=True
marathon.host=localhost
marathon.port=8080
package.cache=tmp/cache
package.sources=['git://github.com/mesosphere/universe.git', \
@@ -339,6 +340,12 @@ def test_set_missing_property(env):
_get_value('marathon.host', 'localhost', env)
def test_set_core_property(env):
_set_value('core.reporting', 'false', env)
_get_value('core.reporting', False, env)
_set_value('core.reporting', 'true', env)
def _set_value(key, value, env):
returncode, stdout, stderr = exec_command(
['dcos', 'config', 'set', key, value],