legacy: remove deprecation warnings (#966)
Remove legacy install scripts and deprecation notices for `package update`, and `--slave/--master` options for `node` subcommand.
This commit is contained in:
@@ -1,150 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -o errexit -o pipefail
|
||||
|
||||
usage()
|
||||
{ # Show usage information.
|
||||
echo "$(basename "$(test -L "$0" && readlink "$0" || echo "$0")") <installation-path> <dcos-url> [--add-path yes/no]"
|
||||
}
|
||||
|
||||
post_install_message()
|
||||
{
|
||||
echo 'Finished installing and configuring DC/OS CLI.'
|
||||
echo ''
|
||||
echo 'Run this command to set up your environment and to get started:'
|
||||
echo "source $1 && dcos help"
|
||||
}
|
||||
|
||||
RC_NAME=""
|
||||
|
||||
write_to_profile()
|
||||
{
|
||||
echo "" >> ~/"$2";
|
||||
echo "# path to the DC/OS CLI binary" >> ~/"$2";
|
||||
echo "if [[ \"\$PATH\" != *\"$1\"* ]];" >> ~/"$2";
|
||||
echo " then export PATH=\$PATH:$1;" >> ~/"$2";
|
||||
echo "fi" >> ~/"$2";
|
||||
}
|
||||
|
||||
add_dcos_path_to_profile()
|
||||
{
|
||||
UNAME=`uname`
|
||||
case "$UNAME" in
|
||||
Linux ) RC_NAME=".bashrc";;
|
||||
Darwin ) RC_NAME=".bash_profile";;
|
||||
CYGWIN* ) RC_NAME=".bashrc";;
|
||||
MINGW* ) RC_NAME=".profile";;
|
||||
* ) RC_NAME=".bashrc";;
|
||||
esac
|
||||
write_to_profile "$1" "$RC_NAME"
|
||||
}
|
||||
|
||||
prompt_add_dcos_path_to_profile()
|
||||
{
|
||||
while true; do
|
||||
echo ""
|
||||
read -p "Modify your bash profile to add DCOS to your PATH? [yes/no] " ANSWER
|
||||
echo ""
|
||||
case "$ANSWER" in
|
||||
[Yy]* ) add_dcos_path_to_profile "$1"; break;;
|
||||
[Nn]* ) break;;
|
||||
* ) echo "Please answer yes or no.";;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
check_pip_version()
|
||||
{
|
||||
PIP_INFO=$(pip -V);
|
||||
REGEX="([0-9]+)\.([0-9]+)";
|
||||
[[ $PIP_INFO =~ $REGEX ]];
|
||||
MAJOR_PIP_VERSION="${BASH_REMATCH[1]}";
|
||||
MINOR_PIP_VERSION="${BASH_REMATCH[2]}";
|
||||
if [ "$MAJOR_PIP_VERSION" -lt 1 ] || ([ "$MAJOR_PIP_VERSION" -eq 1 ] && [ "$MINOR_PIP_VERSION" -le 4 ]);
|
||||
then echo "Pip version must be greater than 1.4. Aborting.";
|
||||
exit 1;
|
||||
fi
|
||||
}
|
||||
|
||||
check_dcoscli_version()
|
||||
{
|
||||
if [ ! -z "$DCOS_CLI_VERSION" ]; then
|
||||
# result is the larger of the two versions
|
||||
COSMOS_VERSION="0.4.0"
|
||||
# convert the str to numbers, sort, and return the larger
|
||||
result=$(echo -e "$COSMOS_VERSION\n$DCOS_CLI_VERSION" | sed '/^$/d' | sort -nr | head -1)
|
||||
# if DCOS_CLI_VERSION >= COSMOS_VERSION, exit
|
||||
if [ "$result" = "$DCOS_CLI_VERSION" ]; then
|
||||
echo "Legacy mode is only supported in dcoscli version <0.4.0. Aborting.";
|
||||
exit 1;
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$#" -lt 2 ]; then
|
||||
usage;
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
check_pip_version;
|
||||
check_dcoscli_version;
|
||||
|
||||
ARGS=( "$@" );
|
||||
|
||||
VIRTUAL_ENV_PATH=$(python -c "import os; print(os.path.realpath('"${ARGS[0]}"'))")
|
||||
if [[ $VIRTUAL_ENV_PATH =~ \ ]];
|
||||
then echo "Spaces are not permitted in the installation path. Please try again with another path.";
|
||||
exit 1;
|
||||
fi
|
||||
DCOS_URL=${ARGS[1]}
|
||||
|
||||
command -v virtualenv >/dev/null 2>&1 || { echo "Cannot find virtualenv. You may need to install it by following the documentation at https://dcos.io/docs/usage/cli/install/. Aborting."; exit 1; }
|
||||
|
||||
VIRTUALENV_VERSION=$(virtualenv --version)
|
||||
VERSION_REGEX="s#[^0-9]*\([0-9]*\)[.]\([0-9]*\)[.]\([0-9]*\)\([0-9A-Za-z-]*\)#\1#"
|
||||
|
||||
eval MAJOR=`echo $VIRTUALENV_VERSION | sed -e $VERSION_REGEX`
|
||||
if [ $MAJOR -lt 12 ];
|
||||
then echo "Virtualenv version must be 12 or greater. Aborting.";
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
echo "Installing DC/OS CLI from PyPI...";
|
||||
echo "";
|
||||
|
||||
# Let's first setup a virtualenv: we are assuming that the path is absolute
|
||||
mkdir -p "$VIRTUAL_ENV_PATH"
|
||||
virtualenv "$VIRTUAL_ENV_PATH"
|
||||
|
||||
# Install the DC/OS CLI package, using version if set
|
||||
if [ -z "$DCOS_CLI_VERSION" ]; then
|
||||
"$VIRTUAL_ENV_PATH/bin/pip" install --quiet "dcoscli<0.4.0"
|
||||
else
|
||||
"$VIRTUAL_ENV_PATH/bin/pip" install --quiet "dcoscli==$DCOS_CLI_VERSION"
|
||||
fi
|
||||
|
||||
ENV_SETUP="$VIRTUAL_ENV_PATH/bin/env-setup"
|
||||
source "$ENV_SETUP"
|
||||
dcos config set core.reporting true
|
||||
dcos config set core.dcos_url $DCOS_URL
|
||||
dcos config set core.ssl_verify false
|
||||
dcos config set core.timeout 5
|
||||
dcos config set package.cache ~/.dcos/cache
|
||||
dcos config set package.sources '["https://github.com/mesosphere/universe/archive/version-1.x.zip"]'
|
||||
dcos package update
|
||||
|
||||
ADD_PATH=""
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
--add-path ) ADD_PATH="$2"; break;;
|
||||
* ) shift;;
|
||||
esac
|
||||
done
|
||||
|
||||
case "$ADD_PATH" in
|
||||
[Yy]* ) add_dcos_path_to_profile "$VIRTUAL_ENV_PATH/bin";;
|
||||
[Nn]* ) ;;
|
||||
* ) prompt_add_dcos_path_to_profile "$VIRTUAL_ENV_PATH/bin";;
|
||||
esac
|
||||
|
||||
post_install_message "$ENV_SETUP"
|
||||
@@ -1,151 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -o errexit -o pipefail
|
||||
|
||||
usage()
|
||||
{ # Show usage information.
|
||||
echo "$(basename "$(test -L "$0" && readlink "$0" || echo "$0")") <installation-path> <dcos-url> [--add-path yes/no]"
|
||||
}
|
||||
|
||||
post_install_message()
|
||||
{
|
||||
echo 'Finished installing and configuring DC/OS CLI.'
|
||||
echo ''
|
||||
echo 'Run this command to set up your environment and to get started:'
|
||||
echo "source $1 && dcos help"
|
||||
}
|
||||
|
||||
RC_NAME=""
|
||||
|
||||
write_to_profile()
|
||||
{
|
||||
echo "" >> ~/"$2";
|
||||
echo "# path to the DC/OS CLI binary" >> ~/"$2";
|
||||
echo "if [[ \"\$PATH\" != *\"$1\"* ]];" >> ~/"$2";
|
||||
echo " then export PATH=\$PATH:$1;" >> ~/"$2";
|
||||
echo "fi" >> ~/"$2";
|
||||
}
|
||||
|
||||
add_dcos_path_to_profile()
|
||||
{
|
||||
UNAME=`uname`
|
||||
case "$UNAME" in
|
||||
Linux ) RC_NAME=".bashrc";;
|
||||
Darwin ) RC_NAME=".bash_profile";;
|
||||
CYGWIN* ) RC_NAME=".bashrc";;
|
||||
MINGW* ) RC_NAME=".profile";;
|
||||
* ) RC_NAME=".bashrc";;
|
||||
esac
|
||||
write_to_profile "$1" "$RC_NAME"
|
||||
}
|
||||
|
||||
prompt_add_dcos_path_to_profile()
|
||||
{
|
||||
while true; do
|
||||
echo ""
|
||||
read -p "Modify your bash profile to add DC/OS to your PATH? [yes/no] " ANSWER
|
||||
echo ""
|
||||
case "$ANSWER" in
|
||||
[Yy]* ) add_dcos_path_to_profile "$1"; break;;
|
||||
[Nn]* ) break;;
|
||||
* ) echo "Please answer yes or no.";;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
check_pip_version()
|
||||
{
|
||||
PIP_INFO=$(pip -V);
|
||||
REGEX="([0-9]+)\.([0-9]+)";
|
||||
[[ $PIP_INFO =~ $REGEX ]];
|
||||
MAJOR_PIP_VERSION="${BASH_REMATCH[1]}";
|
||||
MINOR_PIP_VERSION="${BASH_REMATCH[2]}";
|
||||
if [ "$MAJOR_PIP_VERSION" -lt 1 ] || ([ "$MAJOR_PIP_VERSION" -eq 1 ] && [ "$MINOR_PIP_VERSION" -le 4 ]);
|
||||
then echo "Pip version must be greater than 1.4. Aborting.";
|
||||
exit 1;
|
||||
fi
|
||||
}
|
||||
|
||||
check_dcoscli_version()
|
||||
{
|
||||
if [ ! -z "$DCOS_CLI_VERSION" ]; then
|
||||
COSMOS_VERSION="0.4.0"
|
||||
# result is the larger of the two versions
|
||||
# convert the str to numbers, sort, and return the larger
|
||||
result=$(echo -e "$COSMOS_VERSION\n$DCOS_CLI_VERSION" | sed '/^$/d' | sort -nr | head -1)
|
||||
# if DCOS_CLI_VERSION >= COSMOS_VERSION, exit
|
||||
if [ "$result" = "$DCOS_CLI_VERSION" ]; then
|
||||
echo "Legacy mode is only supported in dcoscli version <0.4.0. Aborting.";
|
||||
exit 1;
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$#" -lt 2 ]; then
|
||||
usage;
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
check_pip_version;
|
||||
check_dcoscli_version;
|
||||
|
||||
ARGS=( "$@" );
|
||||
|
||||
VIRTUAL_ENV_PATH=$(python -c "import os; print(os.path.realpath('"${ARGS[0]}"'))")
|
||||
if [[ $VIRTUAL_ENV_PATH =~ \ ]];
|
||||
then echo "Spaces are not permitted in the installation path. Please try again with another path.";
|
||||
exit 1;
|
||||
fi
|
||||
DCOS_URL=${ARGS[1]}
|
||||
|
||||
command -v virtualenv >/dev/null 2>&1 || { echo "Cannot find virtualenv. You may need to install it by following the documentation at https://dcos.io/docs/usage/cli/install/. Aborting."; exit 1; }
|
||||
|
||||
VIRTUALENV_VERSION=$(virtualenv --version)
|
||||
VERSION_REGEX="s#[^0-9]*\([0-9]*\)[.]\([0-9]*\)[.]\([0-9]*\)\([0-9A-Za-z-]*\)#\1#"
|
||||
|
||||
eval MAJOR=`echo $VIRTUALENV_VERSION | sed -e $VERSION_REGEX`
|
||||
if [ $MAJOR -lt 12 ];
|
||||
then echo "Virtualenv version must be 12 or greater. Aborting.";
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
echo "Installing DC/OS CLI from PyPI...";
|
||||
echo "";
|
||||
|
||||
# Let's first setup a virtualenv: we are assuming that the path is absolute
|
||||
mkdir -p "$VIRTUAL_ENV_PATH"
|
||||
virtualenv "$VIRTUAL_ENV_PATH"
|
||||
|
||||
# Install the DC/OS CLI package, using version if set
|
||||
if [ -z "$DCOS_CLI_VERSION" ]; then
|
||||
"$VIRTUAL_ENV_PATH/bin/pip" install --quiet "dcoscli<0.4.0"
|
||||
else
|
||||
"$VIRTUAL_ENV_PATH/bin/pip" install --quiet "dcoscli==$DCOS_CLI_VERSION"
|
||||
fi
|
||||
|
||||
ENV_SETUP="$VIRTUAL_ENV_PATH/bin/env-setup"
|
||||
source "$ENV_SETUP"
|
||||
dcos config set core.email anonymous-optout
|
||||
dcos config set core.reporting false
|
||||
dcos config set core.dcos_url $DCOS_URL
|
||||
dcos config set core.ssl_verify false
|
||||
dcos config set core.timeout 5
|
||||
dcos config set package.cache ~/.dcos/cache
|
||||
dcos config set package.sources '["https://github.com/mesosphere/universe/archive/version-1.x.zip"]'
|
||||
dcos package update
|
||||
|
||||
ADD_PATH=""
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
--add-path ) ADD_PATH="$2"; break;;
|
||||
* ) shift;;
|
||||
esac
|
||||
done
|
||||
|
||||
case "$ADD_PATH" in
|
||||
[Yy]* ) add_dcos_path_to_profile "$VIRTUAL_ENV_PATH/bin";;
|
||||
[Nn]* ) ;;
|
||||
* ) prompt_add_dcos_path_to_profile "$VIRTUAL_ENV_PATH/bin";;
|
||||
esac
|
||||
|
||||
post_install_message "$ENV_SETUP"
|
||||
@@ -84,14 +84,6 @@ def _set(name, value):
|
||||
:rtype: int
|
||||
"""
|
||||
|
||||
if name == "package.sources":
|
||||
notice = ("This config property has been deprecated. "
|
||||
"Please add your repositories with `dcos package repo add`")
|
||||
return DCOSException(notice)
|
||||
if name == "core.email":
|
||||
notice = "This config property has been deprecated."
|
||||
return DCOSException(notice)
|
||||
|
||||
toml, msg = config.set_val(name, value)
|
||||
emitter.publish(DefaultError(msg))
|
||||
|
||||
|
||||
@@ -11,11 +11,11 @@ Usage:
|
||||
dcos node diagnostics delete <bundle>
|
||||
dcos node diagnostics download <bundle> [--location=<location>]
|
||||
dcos node list-components [--leader --mesos-id=<mesos-id> --json]
|
||||
dcos node log [--follow --lines=N --leader --master --mesos-id=<mesos-id> --slave=<agent-id>]
|
||||
dcos node log [--follow --lines=N --leader --mesos-id=<mesos-id>]
|
||||
[--component=<component-name> --filter=<filter>...]
|
||||
dcos node metrics details <mesos-id> [--json]
|
||||
dcos node metrics summary <mesos-id> [--json]
|
||||
dcos node ssh (--leader | --master | --mesos-id=<mesos-id> | --private-ip=<private-ip> | --slave=<agent-id>)
|
||||
dcos node ssh (--leader | --mesos-id=<mesos-id> | --private-ip=<private-ip>)
|
||||
[--config-file=<path>]
|
||||
[--user=<user>]
|
||||
[--master-proxy]
|
||||
@@ -75,8 +75,6 @@ Options:
|
||||
--location=<location>
|
||||
Download the diagnostics bundle to a specific location. If not set, the
|
||||
default location is your current working directory.
|
||||
--master
|
||||
This option is deprecated and is replaced by `--leader`.
|
||||
--master-proxy
|
||||
Proxy the SSH connection through a master node. This can be useful when
|
||||
accessing DC/OS from a separate network. For example, in the default AWS
|
||||
@@ -92,8 +90,6 @@ Options:
|
||||
Agent node with the provided private IP.
|
||||
--proxy-ip=<proxy-ip>
|
||||
Proxy the SSH connection through a different IP address.
|
||||
--slave=<agent-id>
|
||||
This option is deprecated and is replaced by `--mesos-id`.
|
||||
--status
|
||||
Print diagnostics job status.
|
||||
--user=<user>
|
||||
|
||||
@@ -22,7 +22,6 @@ Usage:
|
||||
dcos package search [<query> --json]
|
||||
dcos package uninstall <package-name>
|
||||
[--cli | [--app --app-id=<app-id> --all]]
|
||||
dcos package update
|
||||
|
||||
Commands:
|
||||
describe
|
||||
@@ -42,9 +41,6 @@ Commands:
|
||||
Search the package repository.
|
||||
uninstall
|
||||
Uninstall a package.
|
||||
update
|
||||
This command has been deprecated. Repositories are dynamically updated
|
||||
when they are added by the `dcos package repo add` command.
|
||||
|
||||
Options:
|
||||
--all
|
||||
|
||||
@@ -41,15 +41,6 @@ def _main(argv):
|
||||
argv=argv,
|
||||
version="dcos-node version {}".format(dcoscli.version))
|
||||
|
||||
if args.get('--master'):
|
||||
raise DCOSException(
|
||||
'--master has been deprecated. Please use --leader.'
|
||||
)
|
||||
elif args.get('--slave'):
|
||||
raise DCOSException(
|
||||
'--slave has been deprecated. Please use --mesos-id.'
|
||||
)
|
||||
|
||||
return cmds.execute(_cmds(), args)
|
||||
|
||||
|
||||
|
||||
@@ -43,11 +43,6 @@ def _cmds():
|
||||
"""
|
||||
|
||||
return [
|
||||
cmds.Command(
|
||||
hierarchy=['package', 'update'],
|
||||
arg_keys=[],
|
||||
function=_update),
|
||||
|
||||
cmds.Command(
|
||||
hierarchy=['package', 'repo', 'list'],
|
||||
arg_keys=['--json'],
|
||||
@@ -128,19 +123,6 @@ def _package(config_schema, info):
|
||||
return 0
|
||||
|
||||
|
||||
def _update():
|
||||
"""
|
||||
:returns: Deprecation notice
|
||||
:rtype: str
|
||||
"""
|
||||
|
||||
get_package_manager()
|
||||
notice = ("This command has been deprecated. "
|
||||
"Repositories will be automatically updated after they are added"
|
||||
" by `dcos package repo add`")
|
||||
raise DCOSException(notice)
|
||||
|
||||
|
||||
def _list_repos(is_json):
|
||||
"""List configured package repositories.
|
||||
|
||||
|
||||
@@ -82,21 +82,6 @@ def test_get_top_property(env):
|
||||
b"possible properties are:\n")
|
||||
|
||||
|
||||
def test_set_package_sources_property():
|
||||
notice = (b"This config property has been deprecated. "
|
||||
b"Please add your repositories with `dcos package repo add`\n")
|
||||
assert_command(['dcos', 'config', 'set', 'package.sources', '[\"foo\"]'],
|
||||
stderr=notice,
|
||||
returncode=1)
|
||||
|
||||
|
||||
def test_set_core_email_property():
|
||||
notice = (b"This config property has been deprecated.\n")
|
||||
assert_command(['dcos', 'config', 'set', 'core.email', 'foo@bar.com'],
|
||||
stderr=notice,
|
||||
returncode=1)
|
||||
|
||||
|
||||
def test_set_existing_string_property(env):
|
||||
new_value = 'http://dcos.snakeoil.mesosphere.com:5081'
|
||||
with update_config('core.dcos_url', new_value, env):
|
||||
|
||||
@@ -209,26 +209,6 @@ def test_node_ssh_master_proxy():
|
||||
_node_ssh(['--leader', '--master-proxy'])
|
||||
|
||||
|
||||
def test_master_arg_deprecation_notice():
|
||||
stderr = b"--master has been deprecated. Please use --leader.\n"
|
||||
assert_command(['dcos', 'node', 'log', '--master'],
|
||||
stderr=stderr,
|
||||
returncode=1)
|
||||
assert_command(['dcos', 'node', 'ssh', '--master'],
|
||||
stderr=stderr,
|
||||
returncode=1)
|
||||
|
||||
|
||||
def test_slave_arg_deprecation_notice():
|
||||
stderr = b"--slave has been deprecated. Please use --mesos-id.\n"
|
||||
assert_command(['dcos', 'node', 'log', '--slave=bogus'],
|
||||
stderr=stderr,
|
||||
returncode=1)
|
||||
assert_command(['dcos', 'node', 'ssh', '--slave=bogus'],
|
||||
stderr=stderr,
|
||||
returncode=1)
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.platform == 'win32',
|
||||
reason='No pseudo terminal on windows')
|
||||
def test_node_ssh_with_command():
|
||||
|
||||
@@ -67,15 +67,6 @@ def test_version():
|
||||
stdout=b'dcos-package version SNAPSHOT\n')
|
||||
|
||||
|
||||
def test_update_deprecation_notice():
|
||||
notice = (b"This command has been deprecated. "
|
||||
b"Repositories will be automatically updated after they are"
|
||||
b" added by `dcos package repo add`\n")
|
||||
assert_command(['dcos', 'package', 'update'],
|
||||
stderr=notice,
|
||||
returncode=1)
|
||||
|
||||
|
||||
def test_repo_list():
|
||||
repo_list = bytes(
|
||||
"test-universe: {}\n".format(UNIVERSE_TEST_REPO), 'utf-8')
|
||||
|
||||
Reference in New Issue
Block a user