salt icon indicating copy to clipboard operation
salt copied to clipboard

timezone.system error: CommandExecutionError: Failed to parse timedatectl output, this is likely a bug

Open ksmitdevops opened this issue 11 years ago • 5 comments

My state:

America/New_York:
  timezone.system

Debug log:

salt-call state.sls base.timezone -l debug
[DEBUG   ] Reading configuration from /etc/salt/minion
[DEBUG   ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[DEBUG   ] Including configuration from '/etc/salt/minion.d/grains.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/grains.conf
[DEBUG   ] Configuration file path: /etc/salt/minion
[WARNING ] Insecure logging configuration detected! Sensitive data may be logged.
[DEBUG   ] Reading configuration from /etc/salt/minion
[DEBUG   ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[DEBUG   ] Including configuration from '/etc/salt/minion.d/grains.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/grains.conf
[DEBUG   ] Please install 'virt-what' to improve results of the 'virtual' grain.
[DEBUG   ] Initializing new SAuth for ('/etc/salt/pki/minion', 'lnprmultidb02', 'tcp://10.10.15.189:4506')
[DEBUG   ] Generated random reconnect delay between '1000ms' and '11000ms' (5858)
[DEBUG   ] Setting zmq_reconnect_ivl to '5858ms'
[DEBUG   ] Setting zmq_reconnect_ivl_max to '11000ms'
[DEBUG   ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'lnprmultidb02', 'tcp://10.10.15.189:4506', 'aes')
[DEBUG   ] Initializing new SAuth for ('/etc/salt/pki/minion', 'lnprmultidb02', 'tcp://10.10.15.189:4506')
[DEBUG   ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'lnprmultidb02', 'tcp://10.10.15.189:4506', 'clear')
[DEBUG   ] Decrypting the current master AES key
[DEBUG   ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[DEBUG   ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] LazyLoaded state.sls
[DEBUG   ] LazyLoaded saltutil.is_running
[DEBUG   ] LazyLoaded grains.get
[DEBUG   ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'lnprmultidb02', 'tcp://10.10.15.189:4506', 'aes')
[DEBUG   ] Initializing new SAuth for ('/etc/salt/pki/minion', 'lnprmultidb02', 'tcp://10.10.15.189:4506')
[DEBUG   ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'lnprmultidb02', 'tcp://10.10.15.189:4506', 'aes')
[DEBUG   ] Initializing new SAuth for ('/etc/salt/pki/minion', 'lnprmultidb02', 'tcp://10.10.15.189:4506')
[DEBUG   ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[INFO    ] Loading fresh modules for state activity
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] In saltenv 'base', looking at rel_path u'base/timezone.sls' to resolve u'salt://base/timezone.sls'
[DEBUG   ] In saltenv 'base', ** considering ** path u'/var/cache/salt/minion/files/base/base/timezone.sls' to resolve u'salt://base/timezone.sls'
[DEBUG   ] Fetching file from saltenv 'base', ** attempting ** u'salt://base/timezone.sls'
[DEBUG   ] No dest file found 
[INFO    ] Fetching file from saltenv 'base', ** done ** u'base/timezone.sls'
[DEBUG   ] compile template: /var/cache/salt/minion/files/base/base/timezone.sls
[DEBUG   ] Jinja search path: ['/var/cache/salt/minion/files/base']
[DEBUG   ] Rendered data from file: /var/cache/salt/minion/files/base/base/timezone.sls:
America/New_York:
  timezone.system: []

[DEBUG   ] LazyLoaded config.get
[DEBUG   ] Results of YAML rendering: 
OrderedDict([('America/New_York', OrderedDict([('timezone.system', [])]))])
[DEBUG   ] LazyLoaded timezone.get_zone
[DEBUG   ] LazyLoaded timezone.system
[INFO    ] Running state [America/New_York] at time 11:08:53.983795
[INFO    ] Executing state timezone.system for America/New_York
[DEBUG   ] LazyLoaded cmd.run
[INFO    ] Executing command ['timedatectl'] in directory '/root'
[ERROR   ] Command ['timedatectl'] failed with return code: 1
[ERROR   ] output: Failed to create bus connection: No such file or directory
[ERROR   ] An exception occurred in this state: Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1591, in call
    **cdata['kwargs'])
  File "/usr/lib/python2.7/dist-packages/salt/states/timezone.py", line 73, in system
    if __salt__['timezone.get_hwclock']() == 'localtime':
  File "/usr/lib/python2.7/dist-packages/salt/modules/timezone.py", line 273, in get_hwclock
    'Failed to parse timedatectl output, this is likely a bug'
CommandExecutionError: Failed to parse timedatectl output, this is likely a bug

[INFO    ] Completed state [America/New_York] at time 11:08:54.008322
[DEBUG   ] File /var/cache/salt/minion/accumulator/139778536598416 does not exist, no need to cleanup.
[DEBUG   ] LazyLoaded config.option
[DEBUG   ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'lnprmultidb02', 'tcp://10.10.15.189:4506', 'aes')
[DEBUG   ] Initializing new SAuth for ('/etc/salt/pki/minion', 'lnprmultidb02', 'tcp://10.10.15.189:4506')
[DEBUG   ] LazyLoaded highstate.output
local:
----------
          ID: America/New_York
    Function: timezone.system
      Result: False
     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1591, in call
                  **cdata['kwargs'])
                File "/usr/lib/python2.7/dist-packages/salt/states/timezone.py", line 73, in system
                  if __salt__['timezone.get_hwclock']() == 'localtime':
                File "/usr/lib/python2.7/dist-packages/salt/modules/timezone.py", line 273, in get_hwclock
                  'Failed to parse timedatectl output, this is likely a bug'
              CommandExecutionError: Failed to parse timedatectl output, this is likely a bug
     Started: 11:08:53.983795
    Duration: 24.527 ms
     Changes:   

Summary for local
------------
Succeeded: 0
Failed:    1
------------
Total states run:     1
Total run time:  24.527 ms

Salt minion info:

cat /etc/debian_version 
8.1

salt-minion --versions-report
Salt Version:
           Salt: 2015.8.1

Dependency Versions:
         Jinja2: 2.7.3
       M2Crypto: 0.21.1
           Mako: 1.0.0
         PyYAML: 3.11
          PyZMQ: 14.4.0
         Python: 2.7.9 (default, Mar 23 2015, 11:40:39)
           RAET: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5
           cffi: 0.8.6
       cherrypy: Not Installed
       dateutil: 2.2
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
        libnacl: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.2
   mysql-python: 1.2.3
      pycparser: 2.10
       pycrypto: 2.6.1
         pygit2: Not Installed
   python-gnupg: Not Installed
          smmap: Not Installed
        timelib: Not Installed

System Versions:
           dist: debian 8.1 
        machine: x86_64
        release: 3.19.1-vger
         system: debian 8.1 

Salt master info:

cat /etc/debian_version 
7.8

salt-master --versions-report
Salt Version:
           Salt: 2015.8.1

Dependency Versions:
         Jinja2: 2.8
       M2Crypto: 0.22
           Mako: Not Installed
         PyYAML: 3.11
          PyZMQ: 14.7.0
         Python: 2.7.3 (default, Mar 13 2014, 11:03:55)
           RAET: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.4
           cffi: 1.1.2
       cherrypy: 3.7.0
       dateutil: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
        libnacl: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: Not Installed
      pycparser: 2.14
       pycrypto: 2.6.1
         pygit2: Not Installed
   python-gnupg: Not Installed
          smmap: Not Installed
        timelib: Not Installed

System Versions:
           dist: debian 7.8 
        machine: x86_64
        release: 3.2.0-4-amd64
         system: debian 7.8 

ksmitdevops avatar Nov 03 '15 16:11 ksmitdevops

@schlagify, thanks for the report. Are you running salt-call state.sls base.timezone -l debug on the minion or on the master? Also, what is the output from timedatectl on the same system?

jfindlay avatar Nov 03 '15 21:11 jfindlay

@jfindlay that was -l debug output on the minion.

looks like it gives an error, which explains why the state fails. i'll look into the error to see what i can do to fix it.

# timedatectl 
Failed to create bus connection: No such file or directory
# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 8.1 (jessie)
Release:    8.1
Codename:   jessie

ksmitdevops avatar Nov 03 '15 21:11 ksmitdevops

i just came across: https://github.com/saltstack/salt/issues/23223 , which seems identical to what i am seeing.

ksmitdevops avatar Nov 03 '15 21:11 ksmitdevops

@schlagify, all the information we need is here anyway. I have updated the module to return more/better information and to always check the retcode of timedatectl. I don't know if you would consider this issue fixed with the update as timedatectl doesn't give a very useful error message.

jfindlay avatar Nov 04 '15 00:11 jfindlay

@jfindlay cool, yeah, i figured the decision was best left to you. thank you!

ksmitdevops avatar Nov 04 '15 14:11 ksmitdevops