dont reset system locale when running rabbitmqctl commands

Observe the errors with rabbitmq 3.7.3.
```
ERROR: RabbitMQ command failed: warning: the VM is running with native name encoding of latin1 which may cause Elixir to malfunction as it expects utf8.
Please ensure your locale is set to UTF-8 (which can be verified by running "locale" in your shell)
```
This commit is contained in:
Daniel Dao 2018-03-06 14:42:08 +00:00 committed by rallytime
parent 95ef006e00
commit e96ab6778e
No known key found for this signature in database
GPG Key ID: E8F1A4B90D0DEA19

View File

@ -223,6 +223,7 @@ def list_users(runas=None):
runas = salt.utils.get_user()
res = __salt__['cmd.run_all'](
[RABBITMQCTL, 'list_users', '-q'],
reset_system_locale=False,
runas=runas,
python_shell=False)
@ -246,6 +247,7 @@ def list_vhosts(runas=None):
runas = salt.utils.get_user()
res = __salt__['cmd.run_all'](
[RABBITMQCTL, 'list_vhosts', '-q'],
reset_system_locale=False,
runas=runas,
python_shell=False)
_check_response(res)
@ -320,6 +322,7 @@ def add_user(name, password=None, runas=None):
res = __salt__['cmd.run_all'](
cmd,
reset_system_locale=False,
output_loglevel='quiet',
runas=runas,
python_shell=python_shell)
@ -352,6 +355,7 @@ def delete_user(name, runas=None):
runas = salt.utils.get_user()
res = __salt__['cmd.run_all'](
[RABBITMQCTL, 'delete_user', name],
reset_system_locale=False,
python_shell=False,
runas=runas)
msg = 'Deleted'
@ -387,6 +391,7 @@ def change_password(name, password, runas=None):
cmd = [RABBITMQCTL, 'change_password', name, password]
res = __salt__['cmd.run_all'](
cmd,
reset_system_locale=False,
runas=runas,
output_loglevel='quiet',
python_shell=python_shell)
@ -409,6 +414,7 @@ def clear_password(name, runas=None):
runas = salt.utils.get_user()
res = __salt__['cmd.run_all'](
[RABBITMQCTL, 'clear_password', name],
reset_system_locale=False,
runas=runas,
python_shell=False)
msg = 'Password Cleared'
@ -434,7 +440,7 @@ def check_password(name, password, runas=None):
runas = salt.utils.get_user()
try:
res = __salt__['cmd.run']([RABBITMQCTL, 'status'], runas=runas, python_shell=False)
res = __salt__['cmd.run']([RABBITMQCTL, 'status'], reset_system_locale=False, runas=runas, python_shell=False)
server_version = re.search(r'\{rabbit,"RabbitMQ","(.+)"\}', res)
if server_version is None:
@ -466,6 +472,7 @@ def check_password(name, password, runas=None):
res = __salt__['cmd.run_all'](
cmd,
reset_system_locale=False,
runas=runas,
output_loglevel='quiet',
python_shell=python_shell)
@ -481,6 +488,7 @@ def check_password(name, password, runas=None):
res = __salt__['cmd.run_all'](
[RABBITMQCTL, 'eval', cmd],
reset_system_locale=False,
runas=runas,
output_loglevel='quiet',
python_shell=False)
@ -509,6 +517,7 @@ def add_vhost(vhost, runas=None):
runas = salt.utils.get_user()
res = __salt__['cmd.run_all'](
[RABBITMQCTL, 'add_vhost', vhost],
reset_system_locale=False,
runas=runas,
python_shell=False)
@ -530,6 +539,7 @@ def delete_vhost(vhost, runas=None):
runas = salt.utils.get_user()
res = __salt__['cmd.run_all'](
[RABBITMQCTL, 'delete_vhost', vhost],
reset_system_locale=False,
runas=runas,
python_shell=False)
msg = 'Deleted'
@ -551,6 +561,7 @@ def set_permissions(vhost, user, conf='.*', write='.*', read='.*', runas=None):
res = __salt__['cmd.run_all'](
[RABBITMQCTL, 'set_permissions', '-p',
vhost, user, conf, write, read],
reset_system_locale=False,
runas=runas,
python_shell=False)
msg = 'Permissions Set'
@ -571,6 +582,7 @@ def list_permissions(vhost, runas=None):
runas = salt.utils.get_user()
res = __salt__['cmd.run_all'](
[RABBITMQCTL, 'list_permissions', '-q', '-p', vhost],
reset_system_locale=False,
runas=runas,
python_shell=False)
@ -591,6 +603,7 @@ def list_user_permissions(name, runas=None):
runas = salt.utils.get_user()
res = __salt__['cmd.run_all'](
[RABBITMQCTL, 'list_user_permissions', name, '-q'],
reset_system_locale=False,
runas=runas,
python_shell=False)
@ -614,6 +627,7 @@ def set_user_tags(name, tags, runas=None):
res = __salt__['cmd.run_all'](
[RABBITMQCTL, 'set_user_tags', name] + list(tags),
reset_system_locale=False,
runas=runas,
python_shell=False)
msg = "Tag(s) set"
@ -634,6 +648,7 @@ def status(runas=None):
runas = salt.utils.get_user()
res = __salt__['cmd.run_all'](
[RABBITMQCTL, 'status'],
reset_system_locale=False,
runas=runas,
python_shell=False)
_check_response(res)
@ -654,6 +669,7 @@ def cluster_status(runas=None):
runas = salt.utils.get_user()
res = __salt__['cmd.run_all'](
[RABBITMQCTL, 'cluster_status'],
reset_system_locale=False,
runas=runas,
python_shell=False)
_check_response(res)
@ -678,7 +694,7 @@ def join_cluster(host, user='rabbit', ram_node=None, runas=None):
if runas is None and not salt.utils.is_windows():
runas = salt.utils.get_user()
stop_app(runas)
res = __salt__['cmd.run_all'](cmd, runas=runas, python_shell=False)
res = __salt__['cmd.run_all'](cmd, reset_system_locale=False, runas=runas, python_shell=False)
start_app(runas)
return _format_response(res, 'Join')
@ -698,6 +714,7 @@ def stop_app(runas=None):
runas = salt.utils.get_user()
res = __salt__['cmd.run_all'](
[RABBITMQCTL, 'stop_app'],
reset_system_locale=False,
runas=runas,
python_shell=False)
_check_response(res)
@ -718,6 +735,7 @@ def start_app(runas=None):
runas = salt.utils.get_user()
res = __salt__['cmd.run_all'](
[RABBITMQCTL, 'start_app'],
reset_system_locale=False,
runas=runas,
python_shell=False)
_check_response(res)
@ -738,6 +756,7 @@ def reset(runas=None):
runas = salt.utils.get_user()
res = __salt__['cmd.run_all'](
[RABBITMQCTL, 'reset'],
reset_system_locale=False,
runas=runas,
python_shell=False)
_check_response(res)
@ -758,6 +777,7 @@ def force_reset(runas=None):
runas = salt.utils.get_user()
res = __salt__['cmd.run_all'](
[RABBITMQCTL, 'force_reset'],
reset_system_locale=False,
runas=runas,
python_shell=False)
_check_response(res)
@ -778,7 +798,7 @@ def list_queues(runas=None, *args):
runas = salt.utils.get_user()
cmd = [RABBITMQCTL, 'list_queues', '-q']
cmd.extend(args)
res = __salt__['cmd.run_all'](cmd, runas=runas, python_shell=False)
res = __salt__['cmd.run_all'](cmd, reset_system_locale=False, runas=runas, python_shell=False)
_check_response(res)
return _output_to_dict(res['stdout'])
@ -800,7 +820,7 @@ def list_queues_vhost(vhost, runas=None, *args):
runas = salt.utils.get_user()
cmd = [RABBITMQCTL, 'list_queues', '-q', '-p', vhost]
cmd.extend(args)
res = __salt__['cmd.run_all'](cmd, runas=runas, python_shell=False)
res = __salt__['cmd.run_all'](cmd, reset_system_locale=False, runas=runas, python_shell=False)
_check_response(res)
return _output_to_dict(res['stdout'])
@ -823,6 +843,7 @@ def list_policies(vhost="/", runas=None):
runas = salt.utils.get_user()
res = __salt__['cmd.run_all'](
[RABBITMQCTL, 'list_policies', '-q', '-p', vhost],
reset_system_locale=False,
runas=runas,
python_shell=False)
_check_response(res)
@ -873,8 +894,8 @@ def set_policy(vhost, name, pattern, definition, priority=None, runas=None):
if priority:
cmd.extend(['--priority', priority])
cmd.extend([name, pattern, definition])
res = __salt__['cmd.run_all'](cmd, runas=runas, python_shell=False)
log.debug('Set policy: {0}'.format(res['stdout']))
res = __salt__['cmd.run_all'](cmd, reset_system_locale=False, runas=runas, python_shell=False)
log.debug('Set policy: %s', res['stdout'])
return _format_response(res, 'Set')
@ -894,6 +915,7 @@ def delete_policy(vhost, name, runas=None):
runas = salt.utils.get_user()
res = __salt__['cmd.run_all'](
[RABBITMQCTL, 'clear_policy', '-p', vhost, name],
reset_system_locale=False,
runas=runas,
python_shell=False)
log.debug('Delete policy: {0}'.format(res['stdout']))
@ -931,7 +953,7 @@ def list_available_plugins(runas=None):
if runas is None and not salt.utils.is_windows():
runas = salt.utils.get_user()
cmd = [_get_rabbitmq_plugin(), 'list', '-m']
ret = __salt__['cmd.run_all'](cmd, python_shell=False, runas=runas)
ret = __salt__['cmd.run_all'](cmd, reset_system_locale=False, python_shell=False, runas=runas)
_check_response(ret)
return _output_to_list(ret['stdout'])
@ -949,7 +971,7 @@ def list_enabled_plugins(runas=None):
if runas is None and not salt.utils.is_windows():
runas = salt.utils.get_user()
cmd = [_get_rabbitmq_plugin(), 'list', '-m', '-e']
ret = __salt__['cmd.run_all'](cmd, python_shell=False, runas=runas)
ret = __salt__['cmd.run_all'](cmd, reset_system_locale=False, python_shell=False, runas=runas)
_check_response(ret)
return _output_to_list(ret['stdout'])
@ -982,7 +1004,7 @@ def enable_plugin(name, runas=None):
if runas is None and not salt.utils.is_windows():
runas = salt.utils.get_user()
cmd = [_get_rabbitmq_plugin(), 'enable', name]
ret = __salt__['cmd.run_all'](cmd, runas=runas, python_shell=False)
ret = __salt__['cmd.run_all'](cmd, reset_system_locale=False, runas=runas, python_shell=False)
return _format_response(ret, 'Enabled')
@ -999,5 +1021,5 @@ def disable_plugin(name, runas=None):
if runas is None and not salt.utils.is_windows():
runas = salt.utils.get_user()
cmd = [_get_rabbitmq_plugin(), 'disable', name]
ret = __salt__['cmd.run_all'](cmd, runas=runas, python_shell=False)
ret = __salt__['cmd.run_all'](cmd, reset_system_locale=False, runas=runas, python_shell=False)
return _format_response(ret, 'Disabled')