salt icon indicating copy to clipboard operation
salt copied to clipboard

state locale.system throws exception

Open iils-jschmidt opened this issue 2 years ago • 9 comments

Description of Issue

The following state throws an exception at locale.system. This has worked previously, so I assume it as a recent development. Also, I reinstalled the system where the state is applied, but I doubt that is the reason for the exception.

Setup

baseconfig-locales-debconf-set-locales:
  debconf.set:
    - name: locales
    - data:
        'locales/default_environment_locale': {'type': 'select', 'value': 'en_US.UTF-8'}
        'locales/locales_to_be_generated': {'type': 'multiselect', 'value': '[en_US.UTF-8 UTF-8, de_DE.UTF-8 UTF-8]'}

baseconfig-locales-pkg-installed-locales:
  pkg.installed:
    - pkgs:
      - locales
    - require:
      - debconf: locales

baseconfig-locales-locale-present-us-locale:
  locale.present:
    - name: en_US.UTF-8

baseconfig-locales-locale-present-de-locale:
  locale.present:
    - name: de_DE.UTF-8

baseconfig-locales-locale-present-default-locale:
  locale.system:
    - name: en_US.UTF-8

Steps to Reproduce Issue


      ID: baseconfig-locales-locale-present-default-locale
Function: locale.system
    Name: en_US.UTF-8
  Result: False
 Comment: An exception occurred in this state: Traceback (most recent call last):
            File "salt/state.py", line 2276, in call                                                                                                                                    
              ret = self.states[cdata["full"]](                                                                                                                                         
            File "salt/loader/lazy.py", line 149, in __call__                                                                                                                           
              return self.loader.run(run_func, *args, **kwargs)                                                                                                                         
            File "salt/loader/lazy.py", line 1228, in run                                                                                                                               
              return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)                                                                                             
            File "salt/loader/lazy.py", line 1243, in _run_as                                                                                                                           
              return _func_or_method(*args, **kwargs)                                                                                                                                   
            File "salt/loader/lazy.py", line 1276, in wrapper                                                                                                                           
              return f(*args, **kwargs)                                                                                                                                                 
            File "/opt/saltstack/salt/run/salt/states/locale.py", line 42, in system                                                                                                    
              if __salt__["locale.get_locale"]() == name:                                                                                                                               
            File "salt/loader/lazy.py", line 149, in __call__                                                                                                                           
              return self.loader.run(run_func, *args, **kwargs)                                                                                                                         
            File "salt/loader/lazy.py", line 1228, in run                                                                                                                               
              return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)                                                                                             
            File "salt/loader/lazy.py", line 1243, in _run_as                                                                                                                           
              return _func_or_method(*args, **kwargs)                                                                                                                                   
            File "/opt/saltstack/salt/run/salt/modules/localemod.py", line 154, in get_locale                                                                                           
              else _localectl_status()["system_locale"]                                                                                                                                 
          KeyError: 'system_locale'                                                                                                                                                     
 Started: 14:00:25.848827
Duration: 28.94 ms
 Changes:  

Versions Report

Salt Version:
          Salt: 3005.1
 
Dependency Versions:
          cffi: 1.14.6
      cherrypy: unknown
      dateutil: 2.8.1
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.1.0
       libgit2: Not Installed
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: 2.21
      pycrypto: Not Installed
  pycryptodome: 3.9.8
        pygit2: Not Installed
        Python: 3.9.16 (main, Jan  6 2023, 22:49:58)
  python-gnupg: 0.4.8
        PyYAML: 5.4.1
         PyZMQ: 23.2.0
         smmap: Not Installed
       timelib: 0.2.4
       Tornado: 4.5.3
           ZMQ: 4.3.4
 
System Versions:
          dist: debian 11 bullseye
        locale: utf-8
       machine: x86_64
       release: 5.10.0-21-amd64
        system: Linux
       version: Debian GNU/Linux 11 bullseye

iils-jschmidt avatar Jan 26 '23 13:01 iils-jschmidt