Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2014.1 Bump runas deprecations to Lithium #12254

Merged
merged 24 commits into from Apr 24, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions salt/modules/pip.py
Expand Up @@ -259,7 +259,7 @@ def install(pkgs=None,
if runas is not None:
# The user is using a deprecated argument, warn!
salt.utils.warn_until(
'Hydrogen',
'Lithium',
'The \'runas\' argument to pip.install is deprecated, and will be '
'removed in Salt {version}. Please use \'user\' instead.'
)
Expand Down Expand Up @@ -581,7 +581,7 @@ def uninstall(pkgs=None,
if runas is not None:
# The user is using a deprecated argument, warn!
salt.utils.warn_until(
'Hydrogen',
'Lithium',
'The \'runas\' argument to pip.install is deprecated, and will be '
'removed in Salt {version}. Please use \'user\' instead.'
)
Expand Down Expand Up @@ -705,7 +705,7 @@ def freeze(bin_env=None,
if runas is not None:
# The user is using a deprecated argument, warn!
salt.utils.warn_until(
'Hydrogen',
'Lithium',
'The \'runas\' argument to pip.install is deprecated, and will be '
'removed in Salt {version}. Please use \'user\' instead.'
)
Expand Down Expand Up @@ -757,7 +757,7 @@ def list_(prefix=None,
if runas is not None:
# The user is using a deprecated argument, warn!
salt.utils.warn_until(
'Hydrogen',
'Lithium',
'The \'runas\' argument to pip.install is deprecated, and will be '
'removed in Salt {version}. Please use \'user\' instead.'
)
Expand Down
35 changes: 33 additions & 2 deletions salt/states/at.py
Expand Up @@ -20,7 +20,7 @@ def __virtual__():
return 'at.at' in __salt__


def present(name, timespec, tag=None, runas=None, job=None):
def present(name, timespec, tag=None, runas=None, user=None, job=None):
'''
Add a job to queue.

Expand All @@ -36,14 +36,21 @@ def present(name, timespec, tag=None, runas=None, job=None):
runas
Users run the job.

.. deprecated:: 2014.1.4 (Hydrogen)

user
The user to run the at job

.. versionadded:: 2014.1.4 (Hydrogen)

.. code-block:: yaml

rose:
at.present:
- job: 'echo "I love saltstack" > love'
- timespec: '9:9 11/09/13'
- tag: love
- runas: jam
- user: jam

'''
if job:
Expand All @@ -54,6 +61,30 @@ def present(name, timespec, tag=None, runas=None, job=None):
'comment': 'job {0} is add and will run on {1}'.format(job,
timespec)}

salt.utils.warn_until(
'Lithium',
'Please remove \'runas\' support at this stage. \'user\' support was '
'added in 2014.1.4 (Hydrogen). Support will be removed in {version}.',
_dont_call_warnings=True
)
if runas:
# Warn users about the deprecation
ret.setdefault('warnings', []).append(
'The \'runas\' argument is being deprecated in favor of \'user\', '
'please update your state files.'
)
if user is not None and runas is not None:
# user wins over runas but let warn about the deprecation.
ret.setdefault('warnings', []).append(
'Passed both the \'runas\' and \'user\' arguments. Please don\'t. '
'\'runas\' is being ignored in favor of \'user\'.'
)
runas = None
elif runas is not None:
# Support old runas usage
user = runas
runas = None

binary = salt.utils.which('at')

if __opts__['test']:
Expand Down
36 changes: 35 additions & 1 deletion salt/states/composer.py
Expand Up @@ -37,7 +37,9 @@
- php: /usr/local/bin/php
- no_dev: true
'''

# Import salt libs
import salt.utils
from salt.exceptions import CommandExecutionError, CommandNotFoundError


Expand All @@ -52,6 +54,7 @@ def installed(name,
composer=None,
php=None,
runas=None,
user=None,
prefer_source=None,
prefer_dist=None,
no_scripts=None,
Expand All @@ -78,6 +81,13 @@ def installed(name,
runas
Which system user to run composer as.

.. deprecated:: 2014.1.4 (Hydrogen)

user
Which system user to run composer as.

.. versionadded:: 2014.1.4 (Hydrogen)

prefer_source
--prefer-source option of composer.

Expand All @@ -104,12 +114,36 @@ def installed(name,
'''
ret = {'name': name, 'result': None, 'comment': '', 'changes': {}}

salt.utils.warn_until(
'Lithium',
'Please remove \'runas\' support at this stage. \'user\' support was '
'added in 2014.1.4 (Hydrogen).',
_dont_call_warnings=True
)
if runas:
# Warn users about the deprecation
ret.setdefault('warnings', []).append(
'The \'runas\' argument is being deprecated in favor of \'user\', '
'please update your state files.'
)
if user is not None and runas is not None:
# user wins over runas but let warn about the deprecation.
ret.setdefault('warnings', []).append(
'Passed both the \'runas\' and \'user\' arguments. Please don\'t. '
'\'runas\' is being ignored in favor of \'user\'.'
)
runas = None
elif runas is not None:
# Support old runas usage
user = runas
runas = None

try:
call = __salt__['composer.install'](
name,
composer=composer,
php=php,
runas=runas,
runas=user,
prefer_source=prefer_source,
prefer_dist=prefer_dist,
no_scripts=no_scripts,
Expand Down
4 changes: 2 additions & 2 deletions salt/states/gem.py
Expand Up @@ -65,7 +65,7 @@ def installed(name, # pylint: disable=C0103
ret = {'name': name, 'result': None, 'comment': '', 'changes': {}}

salt.utils.warn_until(
'Hydrogen',
'Lithium',
'Please remove \'runas\' support at this stage. \'user\' support was '
'added in 0.17.0',
_dont_call_warnings=True
Expand Down Expand Up @@ -140,7 +140,7 @@ def removed(name, ruby=None, runas=None, user=None):
ret = {'name': name, 'result': None, 'comment': '', 'changes': {}}

salt.utils.warn_until(
'Hydrogen',
'Lithium',
'Please remove \'runas\' support at this stage. \'user\' support was '
'added in 0.17.0',
_dont_call_warnings=True
Expand Down
4 changes: 2 additions & 2 deletions salt/states/git.py
Expand Up @@ -121,7 +121,7 @@ def latest(name,
return _fail(ret, '"target" option is required')

salt.utils.warn_until(
'Hydrogen',
'Lithium',
'Please remove \'runas\' support at this stage. \'user\' support was '
'added in 0.17.0',
_dont_call_warnings=True
Expand Down Expand Up @@ -349,7 +349,7 @@ def present(name, bare=True, runas=None, user=None, force=False):
ret = {'name': name, 'result': True, 'comment': '', 'changes': {}}

salt.utils.warn_until(
'Hydrogen',
'Lithium',
'Please remove \'runas\' support at this stage. \'user\' support was '
'added in 0.17.0',
_dont_call_warnings=True
Expand Down
2 changes: 1 addition & 1 deletion salt/states/hg.py
Expand Up @@ -80,7 +80,7 @@ def latest(name,
ret = {'name': name, 'result': True, 'comment': '', 'changes': {}}

salt.utils.warn_until(
'Hydrogen',
'Lithium',
'Please remove \'runas\' support at this stage. \'user\' support was '
'added in 0.17.0',
_dont_call_warnings=True
Expand Down
6 changes: 3 additions & 3 deletions salt/states/npm.py
Expand Up @@ -61,7 +61,7 @@ def installed(name,
ret = {'name': name, 'result': None, 'comment': '', 'changes': {}}

salt.utils.warn_until(
'Hydrogen',
'Lithium',
'Please remove \'runas\' support at this stage. \'user\' support was '
'added in 0.17.0',
_dont_call_warnings=True
Expand Down Expand Up @@ -156,7 +156,7 @@ def removed(name,
ret = {'name': name, 'result': None, 'comment': '', 'changes': {}}

salt.utils.warn_until(
'Hydrogen',
'Lithium',
'Please remove \'runas\' support at this stage. \'user\' support was '
'added in 0.17.0',
_dont_call_warnings=True
Expand Down Expand Up @@ -230,7 +230,7 @@ def bootstrap(name,
'''
ret = {'name': name, 'result': None, 'comment': '', 'changes': {}}
salt.utils.warn_until(
'Hydrogen',
'Lithium',
'Please remove \'runas\' support at this stage. \'user\' support was '
'added in 0.17.0',
_dont_call_warnings=True
Expand Down
15 changes: 6 additions & 9 deletions salt/states/pip_state.py
Expand Up @@ -248,10 +248,9 @@ def installed(name,
'value of repo, {1!r}'.format(
name,
repo,
version=_SaltStackVersion.from_name(
'Hydrogen').formatted_version
version=_SaltStackVersion.from_name('Lithium').formatted_version
))
salt.utils.warn_until('Hydrogen', msg)
salt.utils.warn_until('Lithium', msg)
ret.setdefault('warnings', []).append(msg)
name = repo

Expand Down Expand Up @@ -313,10 +312,9 @@ def installed(name,
msg = ('The \'runas\' argument to pip.installed is deprecated, and '
'will be removed in Salt {version}. Please use \'user\' '
'instead.'.format(
version=_SaltStackVersion.from_name(
'Hydrogen').formatted_version
version=_SaltStackVersion.from_name('Lithium').formatted_version
))
salt.utils.warn_until('Hydrogen', msg)
salt.utils.warn_until('Lithium', msg)
ret.setdefault('warnings', []).append(msg)

# "There can only be one"
Expand Down Expand Up @@ -507,10 +505,9 @@ def removed(name,
msg = ('The \'runas\' argument to pip.installed is deprecated, and '
'will be removed in Salt {version}. Please use \'user\' '
'instead.'.format(
version=_SaltStackVersion.from_name(
'Hydrogen').formatted_version
version=_SaltStackVersion.from_name('Lithium').formatted_version
))
salt.utils.warn_until('Hydrogen', msg)
salt.utils.warn_until('Lithium', msg)
ret.setdefault('warnings', []).append(msg)

# "There can only be one"
Expand Down
4 changes: 2 additions & 2 deletions salt/states/postgres_database.py
Expand Up @@ -90,7 +90,7 @@ def present(name,
'comment': 'Database {0} is already present'.format(name)}

salt.utils.warn_until(
'Hydrogen',
'Lithium',
'Please remove \'runas\' support at this stage. \'user\' support was '
'added in 0.17.0',
_dont_call_warnings=True
Expand Down Expand Up @@ -228,7 +228,7 @@ def absent(name,
'result': True,
'comment': ''}
salt.utils.warn_until(
'Hydrogen',
'Lithium',
'Please remove \'runas\' support at this stage. \'user\' support was '
'added in 0.17.0',
_dont_call_warnings=True
Expand Down
4 changes: 2 additions & 2 deletions salt/states/postgres_group.py
Expand Up @@ -126,7 +126,7 @@ def present(name,
'comment': 'Group {0} is already present'.format(name)}

salt.utils.warn_until(
'Hydrogen',
'Lithium',
'Please remove \'runas\' support at this stage. \'user\' support was '
'added in 0.17.0',
_dont_call_warnings=True
Expand Down Expand Up @@ -278,7 +278,7 @@ def absent(name,
'comment': ''}

salt.utils.warn_until(
'Hydrogen',
'Lithium',
'Please remove \'runas\' support at this stage. \'user\' support was '
'added in 0.17.0',
_dont_call_warnings=True
Expand Down
4 changes: 2 additions & 2 deletions salt/states/postgres_user.py
Expand Up @@ -125,7 +125,7 @@ def present(name,
'comment': 'User {0} is already present'.format(name)}

salt.utils.warn_until(
'Hydrogen',
'Lithium',
'Please remove \'runas\' support at this stage. \'user\' support was '
'added in 0.17.0',
_dont_call_warnings=True
Expand Down Expand Up @@ -280,7 +280,7 @@ def absent(name,
'comment': ''}

salt.utils.warn_until(
'Hydrogen',
'Lithium',
'Please remove \'runas\' support at this stage. \'user\' support was '
'added in 0.17.0',
_dont_call_warnings=True
Expand Down
2 changes: 1 addition & 1 deletion salt/states/rabbitmq_cluster.py
Expand Up @@ -34,7 +34,7 @@ def join(name, host, user='rabbit', runas=None):
Ensure the RabbitMQ plugin is enabled.

name
Irrelavent, not used (recommended: user@host)
Irrelevant, not used (recommended: user@host)
user
The user to join the cluster as (default: rabbit)
host
Expand Down
2 changes: 1 addition & 1 deletion salt/states/rabbitmq_vhost.py
Expand Up @@ -65,7 +65,7 @@ def present(name,
ret = {'name': name, 'result': True, 'comment': '', 'changes': {}}

salt.utils.warn_until(
'Hydrogen',
'Helium',
'Please start deprecating \'runas\' at this stage. Ping s0undt3ch for '
'additional information or see #6961.',
_dont_call_warnings=True
Expand Down
4 changes: 2 additions & 2 deletions salt/states/rbenv.py
Expand Up @@ -121,7 +121,7 @@ def installed(name, default=False, runas=None, user=None):
ret = {'name': name, 'result': None, 'comment': '', 'changes': {}}

salt.utils.warn_until(
'Hydrogen',
'Lithium',
'Please remove \'runas\' support at this stage. \'user\' support was '
'added in 0.17.0',
_dont_call_warnings=True
Expand Down Expand Up @@ -210,7 +210,7 @@ def absent(name, runas=None, user=None):
ret = {'name': name, 'result': None, 'comment': '', 'changes': {}}

salt.utils.warn_until(
'Hydrogen',
'Lithium',
'Please remove \'runas\' support at this stage. \'user\' support was '
'added in 0.17.0',
_dont_call_warnings=True
Expand Down
4 changes: 2 additions & 2 deletions salt/states/rvm.py
Expand Up @@ -193,7 +193,7 @@ def installed(name, default=False, runas=None, user=None):
ret = {'name': name, 'result': None, 'comment': '', 'changes': {}}

salt.utils.warn_until(
'Hydrogen',
'Lithium',
'Please remove \'runas\' support at this stage. \'user\' support was '
'added in 0.17.0',
_dont_call_warnings=True
Expand Down Expand Up @@ -254,7 +254,7 @@ def gemset_present(name, ruby='default', runas=None, user=None):
ret = {'name': name, 'result': None, 'comment': '', 'changes': {}}

salt.utils.warn_until(
'Hydrogen',
'Lithium',
'Please remove \'runas\' support at this stage. \'user\' support was '
'added in 0.17.0',
_dont_call_warnings=True
Expand Down