From 7cc7fb66df7d47bf1874cd805b2b0a0ea1ea7193 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Armando=20Garc=C3=ADa=20Sancio?= Date: Mon, 18 May 2015 12:22:11 -0700 Subject: [PATCH] Rename the dcos_uri config value to dcos_url --- README.rst | 2 +- bin/install/install-dcos-cli.ps1 | 4 +-- bin/install/install-dcos-cli.sh | 6 ++-- cli/dcoscli/config/main.py | 4 +-- cli/dcoscli/data/config-schema/core.json | 6 ++-- cli/dcoscli/data/config-schema/marathon.json | 6 ++-- cli/tests/data/dcos.toml | 2 +- cli/tests/integrations/cli/test_config.py | 30 ++++++++++---------- cli/tests/integrations/cli/test_marathon.py | 8 +++--- dcos/marathon.py | 4 +-- 10 files changed, 36 insertions(+), 36 deletions(-) diff --git a/README.rst b/README.rst index 6b52eb1..43b6342 100644 --- a/README.rst +++ b/README.rst @@ -51,7 +51,7 @@ Configure Environment and Run #. Configure Marathon, changing the values below as appropriate for your local installation:: - dcos config set marathon.uri http://localhost:8080 + dcos config set marathon.url http://localhost:8080 dcos config append package.sources https://github.com/mesosphere/universe/archive/master.zip dcos config set package.cache /tmp/dcos dcos package update diff --git a/bin/install/install-dcos-cli.ps1 b/bin/install/install-dcos-cli.ps1 index 822f687..e7f538a 100644 --- a/bin/install/install-dcos-cli.ps1 +++ b/bin/install/install-dcos-cli.ps1 @@ -3,7 +3,7 @@ param([Parameter(Mandatory=$true,ValueFromPipeline=$true)] $installation_path, [Parameter(Mandatory=$true,ValueFromPipeline=$true)] [string] - $dcos_uri + $dcos_url ) if (-Not(Get-Command python -errorAction SilentlyContinue)) @@ -92,7 +92,7 @@ if (-Not(Test-Path $DCOS_CONFIG)) { $env:DCOS_CONFIG = $DCOS_CONFIG dcos config set core.reporting true -dcos config set core.dcos_uri $dcos_uri +dcos config set core.dcos_url $dcos_url dcos config set package.cache $env:temp\dcos\package-cache dcos config set package.sources '[\"https://github.com/mesosphere/universe/archive/master.zip\"]' diff --git a/bin/install/install-dcos-cli.sh b/bin/install/install-dcos-cli.sh index 1fe2996..f0b1a68 100755 --- a/bin/install/install-dcos-cli.sh +++ b/bin/install/install-dcos-cli.sh @@ -4,7 +4,7 @@ set -o errexit -o pipefail usage() { # Show usage information. - echo "$(basename "$(test -L "$0" && readlink "$0" || echo "$0")") " + echo "$(basename "$(test -L "$0" && readlink "$0" || echo "$0")") " } if [ "$#" -lt 2 ]; then @@ -15,7 +15,7 @@ fi ARGS=( "$@" ); VIRTUAL_ENV_PATH=$(python -c "import os; print(os.path.realpath('"${ARGS[0]}"'))") -DCOS_URI=${ARGS[1]} +DCOS_URL=${ARGS[1]} command -v virtualenv >/dev/null 2>&1 || { echo "Cannot find virtualenv. Aborting."; exit 1; } @@ -45,7 +45,7 @@ fi ENV_SETUP="$VIRTUAL_ENV_PATH/bin/env-setup" source "$ENV_SETUP" dcos config set core.reporting true -dcos config set core.dcos_uri $DCOS_URI +dcos config set core.dcos_url $DCOS_URL dcos config set package.cache ~/.dcos/cache dcos config set package.sources '["https://github.com/mesosphere/universe/archive/master.zip"]' dcos package update diff --git a/cli/dcoscli/config/main.py b/cli/dcoscli/config/main.py index e33f86e..bbc6cde 100644 --- a/cli/dcoscli/config/main.py +++ b/cli/dcoscli/config/main.py @@ -387,7 +387,7 @@ def _get_config_schema(command): def _split_key(name): """ - :param name: the full property path - e.g. marathon.uri + :param name: the full property path - e.g. marathon.url :type name: str :returns: the section and property name :rtype: (str, str) @@ -396,7 +396,7 @@ def _split_key(name): terms = name.split('.', 1) if len(terms) != 2: raise DCOSException('Property name must have both a section and ' - 'key:
. - E.g. marathon.uri') + 'key:
. - E.g. marathon.url') return (terms[0], terms[1]) diff --git a/cli/dcoscli/data/config-schema/core.json b/cli/dcoscli/data/config-schema/core.json index aaff804..ee645f5 100644 --- a/cli/dcoscli/data/config-schema/core.json +++ b/cli/dcoscli/data/config-schema/core.json @@ -7,10 +7,10 @@ "title": "Your email address", "description": "Your email address" }, - "dcos_uri": { + "dcos_url": { "type": "string", - "title": "DCOS URI", - "description": "The URI to the location of the DCOS" + "title": "DCOS URL", + "description": "The URL to the location of the DCOS" }, "refresh_token": { "type": "string", diff --git a/cli/dcoscli/data/config-schema/marathon.json b/cli/dcoscli/data/config-schema/marathon.json index 074343b..364e3cf 100644 --- a/cli/dcoscli/data/config-schema/marathon.json +++ b/cli/dcoscli/data/config-schema/marathon.json @@ -2,10 +2,10 @@ "$schema": "http://json-schema.org/schema#", "type": "object", "properties": { - "uri": { + "url": { "type": "string", - "title": "Marathon base URI", - "description": "Base URI for talking to Marathon. It overwrites the value specified in core.dcos_uri", + "title": "Marathon base URL", + "description": "Base URL for talking to Marathon. It overwrites the value specified in core.dcos_url", "default": "http://localhost:8080" } }, diff --git a/cli/tests/data/dcos.toml b/cli/tests/data/dcos.toml index 4e7241c..afbca99 100644 --- a/cli/tests/data/dcos.toml +++ b/cli/tests/data/dcos.toml @@ -3,7 +3,7 @@ mesos_master_url = "http://localhost:5050" reporting = false email = "test@mail.com" [marathon] -uri = "http://localhost:8080" +url = "http://localhost:8080" [package] sources = [ "git://github.com/mesosphere/universe.git", "https://github.com/mesosphere/universe/archive/master.zip",] cache = "tmp/cache" diff --git a/cli/tests/integrations/cli/test_config.py b/cli/tests/integrations/cli/test_config.py index 6fcb028..b349aba 100644 --- a/cli/tests/integrations/cli/test_config.py +++ b/cli/tests/integrations/cli/test_config.py @@ -70,7 +70,7 @@ def test_list_property(env): stdout = b"""core.email=test@mail.com core.mesos_master_url=http://localhost:5050 core.reporting=False -marathon.uri=http://localhost:8080 +marathon.url=http://localhost:8080 package.cache=tmp/cache package.sources=['git://github.com/mesosphere/universe.git', \ 'https://github.com/mesosphere/universe/archive/master.zip'] @@ -81,7 +81,7 @@ package.sources=['git://github.com/mesosphere/universe.git', \ def test_get_existing_string_property(env): - _get_value('marathon.uri', 'http://localhost:8080', env) + _get_value('marathon.url', 'http://localhost:8080', env) def test_get_existing_boolean_property(env): @@ -106,9 +106,9 @@ def test_get_top_property(env): def test_set_existing_string_property(env): - _set_value('marathon.uri', 'http://newhost:8081', env) - _get_value('marathon.uri', 'http://newhost:8081', env) - _set_value('marathon.uri', 'http://localhost:8080', env) + _set_value('marathon.url', 'http://newhost:8081', env) + _get_value('marathon.url', 'http://newhost:8081', env) + _set_value('marathon.url', 'http://localhost:8080', env) def test_set_existing_boolean_property(env): @@ -188,22 +188,22 @@ def test_prepend_list(env): def test_append_non_list(env): - stderr = (b"Append/Prepend not supported on 'marathon.uri' " - b"properties - use 'dcos config set marathon.uri new_uri'\n") + stderr = (b"Append/Prepend not supported on 'marathon.url' " + b"properties - use 'dcos config set marathon.url new_uri'\n") assert_command( - ['dcos', 'config', 'append', 'marathon.uri', 'new_uri'], + ['dcos', 'config', 'append', 'marathon.url', 'new_uri'], returncode=1, stderr=stderr, env=env) def test_prepend_non_list(env): - stderr = (b"Append/Prepend not supported on 'marathon.uri' " - b"properties - use 'dcos config set marathon.uri new_uri'\n") + stderr = (b"Append/Prepend not supported on 'marathon.url' " + b"properties - use 'dcos config set marathon.url new_uri'\n") assert_command( - ['dcos', 'config', 'prepend', 'marathon.uri', 'new_uri'], + ['dcos', 'config', 'prepend', 'marathon.url', 'new_uri'], returncode=1, stderr=stderr, env=env) @@ -285,7 +285,7 @@ def test_unset_index_from_string(env): stderr = b'Unsetting based on an index is only supported for lists\n' assert_command( - ['dcos', 'config', 'unset', '--index=0', 'marathon.uri'], + ['dcos', 'config', 'unset', '--index=0', 'marathon.url'], returncode=1, stderr=stderr, env=env) @@ -319,9 +319,9 @@ def test_set_property_key(env): def test_set_missing_property(missing_env): - _set_value('marathon.uri', 'http://localhost:8080', missing_env) - _get_value('marathon.uri', 'http://localhost:8080', missing_env) - _unset_value('marathon.uri', None, missing_env) + _set_value('marathon.url', 'http://localhost:8080', missing_env) + _get_value('marathon.url', 'http://localhost:8080', missing_env) + _unset_value('marathon.url', None, missing_env) def test_set_core_property(env): diff --git a/cli/tests/integrations/cli/test_marathon.py b/cli/tests/integrations/cli/test_marathon.py index c2afee0..057f1be 100644 --- a/cli/tests/integrations/cli/test_marathon.py +++ b/cli/tests/integrations/cli/test_marathon.py @@ -605,10 +605,10 @@ def test_show_task(): def test_bad_configuration(): show_returncode, show_stdout, stderr = exec_command( - ['dcos', 'config', 'show', 'marathon.uri']) + ['dcos', 'config', 'show', 'marathon.url']) assert_command( - ['dcos', 'config', 'set', 'marathon.uri', 'http://localhost:88888']) + ['dcos', 'config', 'set', 'marathon.url', 'http://localhost:88888']) returncode, stdout, stderr = exec_command( ['dcos', 'marathon', 'app', 'list']) @@ -621,9 +621,9 @@ def test_bad_configuration(): if show_returncode == 0: url = show_stdout.decode('utf-8').strip() - assert_command(['dcos', 'config', 'set', 'marathon.uri', url]) + assert_command(['dcos', 'config', 'set', 'marathon.url', url]) else: - assert_command(['dcos', 'config', 'unset', 'marathon.uri']) + assert_command(['dcos', 'config', 'unset', 'marathon.url']) def _list_apps(app_id=None): diff --git a/dcos/marathon.py b/dcos/marathon.py index c50cfc3..80c5193 100644 --- a/dcos/marathon.py +++ b/dcos/marathon.py @@ -35,9 +35,9 @@ def _get_marathon_uri(config): :rtype: str """ - marathon_uri = config.get('marathon.uri') + marathon_uri = config.get('marathon.url') if marathon_uri is None: - marathon_uri = config.get('core.dcos_uri') + marathon_uri = config.get('core.dcos_url') if marathon_uri is None: raise DCOSException(_default_marathon_error())