Skip to content

Instantly share code, notes, and snippets.

@eliasp
Created July 28, 2016 20:53
Show Gist options
  • Save eliasp/5d2ab1cfd5a2d0a5aa3e111d2e4f7066 to your computer and use it in GitHub Desktop.
Save eliasp/5d2ab1cfd5a2d0a5aa3e111d2e4f7066 to your computer and use it in GitHub Desktop.
{% if not 'systemd.sd_booted' in salt %} <======================
# for non-booted systems (e.g. a container during bootstrapping), `timedatectl` can't work
# and `systemd-firstboot` needs to be used instead
{% if not salt['file.is_link']('/etc/localtime') %}
systemd-firstboot-timedate:
cmd.run:
[...]
---
[CRITICAL] Rendering SLS 'base:linux.systemd.timedate' failed: Jinja error:
Traceback (most recent call last):
File "/usr/lib64/python2.7/site-packages/salt/utils/templates.py", line 366, in render_jinja_tmpl
output = template.render(**decoded_context)
File "/usr/lib64/python2.7/site-packages/jinja2/environment.py", line 989, in render
return self.environment.handle_exception(exc_info, True)
File "/usr/lib64/python2.7/site-packages/jinja2/environment.py", line 754, in handle_exception
reraise(exc_type, exc_value, tb)
File "<template>", line 1, in top-level template code
File "/usr/lib64/python2.7/site-packages/salt/utils/templates.py", line 76, in __getitem__
return self.wrapped[name]
File "/usr/lib64/python2.7/site-packages/salt/loader.py", line 1053, in __getitem__
func = super(LazyLoader, self).__getitem__(item)
File "/usr/lib64/python2.7/site-packages/salt/utils/lazy.py", line 88, in __getitem__
if self._load(key):
File "/usr/lib64/python2.7/site-packages/salt/loader.py", line 1440, in _load
raise KeyError
KeyError
; line 1
---
{% if not 'systemd.sd_booted' in salt %} <======================
# for non-booted systems (e.g. a container during bootstrapping), `timedatectl` can't work
# and `systemd-firstboot` needs to be used instead
{% if not salt['file.is_link']('/etc/localtime') %}
systemd-firstboot-timedate:
cmd.run:
[...]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment