Skip to content

Salt system.locale fails on non existent default locale #23767

Closed

Description

@chrimi

Salt state method locale.system fails, if (on Ubuntu/Debian) /etc/default/locale is missing.
This file is not existent after a fresh deboostrap installation (xen guest system).

So my state

de_locale:
  locale.present:
    - name: de_DE.UTF-8

default_locale:
  locale.system:
    - name: de_DE.UTF-8
    - require:
      - locale: de_locale

fails with

2015-05-15 14:26:52,910 [salt.loaded.int.module.cmdmod][ERROR   ][2206] Command 'grep "^LANG=" /etc/default/locale' failed with return code: 2
2015-05-15 14:26:52,911 [salt.loaded.int.module.cmdmod][ERROR   ][2206] output: grep: /etc/default/locale: No such file or directory
2015-05-15 14:26:52,914 [salt.state       ][ERROR   ][2206] An exception occurred in this state: Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1563, in call
    **cdata['kwargs'])
  File "/usr/lib/python2.7/dist-packages/salt/states/locale.py", line 40, in system
    if __salt__['locale.set_locale'](name):
  File "/usr/lib/python2.7/dist-packages/salt/modules/localemod.py", line 140, in set_locale
    '/etc/default/locale', '^LANG=.*', 'LANG="{0}"'.format(locale)
  File "/usr/lib/python2.7/dist-packages/salt/modules/file.py", line 1225, in replace
    raise SaltInvocationError('File not found: {0}'.format(path))
SaltInvocationError: File not found: /etc/default/locale

used version on server:

salt --versions-report
                  Salt: 2014.7.5
                Python: 2.7.3 (default, Dec 18 2014, 19:10:20)
                Jinja2: 2.6
              M2Crypto: 0.21.1
        msgpack-python: 0.1.10
          msgpack-pure: Not Installed
              pycrypto: 2.4.1
               libnacl: Not Installed
                PyYAML: 3.10
                 ioflo: Not Installed
                 PyZMQ: 14.0.1
                  RAET: Not Installed
                   ZMQ: 4.0.4
                  Mako: Not Installed
 Debian source package: 2014.7.5+ds-1precise1

Activity

  1. added a commit that references this issue on May 18, 2015
    e632603
  2. added
    bug
    severity-medium
    P4
    Platform
    fixed-pls-verify
    on May 18, 2015
  3. added this to the Approved milestone on May 18, 2015
  4. jfindlay commented on May 18, 2015

    @jfindlay
    Contributor

    @chrimi, thanks for the report; the fix I have made will be available in 2015.5.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4Platformbugfixed-pls-verifyseverity-medium

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions