Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(init.sls): ensure dbus is available for locale.system state #21

Merged
merged 3 commits into from
Oct 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions locale/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ locale:
config: '/etc/locale.conf'
pkgs: []
present: []
dbus:
pkg: dbus
service: dbus
run_service: true
15 changes: 15 additions & 0 deletions locale/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,21 @@ locale_present_{{ l|replace('.', '_')|replace(' ', '_') }}:
{%- endfor %}

{% if locale.default is defined %}
dbus_for_locale:
pkg.installed:
- name: {{ locale.dbus.pkg }}
- require_in:
- locale: locale_default
{%- if locale.dbus.run_service %}
service.running:
- name: {{ locale.dbus.service }}
- enable: true
- require:
- pkg: dbus_for_locale
- require_in:
# `dbus` is required for running `localectl`
- locale: locale_default
{%- endif %}
locale_default:
locale.system:
- name: {{ locale.default.name }}
Expand Down
6 changes: 6 additions & 0 deletions locale/osfamilymap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ RedHat:
Suse:
pkgs:
- glibc-locale
dbus:
pkg: dbus-1

Gentoo:
dbus:
pkg: sys-apps/dbus

Arch:
pkgs:
Expand Down
40 changes: 39 additions & 1 deletion locale/osfingermap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,42 @@
# you will need to provide at least an empty dict in this file, e.g.
# osfingermap: {}
---
osfingermap: {}
# os: Debian
Debian-10: {}
Debian-9: {}
Debian-8: {}

# os: Ubuntu
Ubuntu-18.04: {}
Ubuntu-16.04:
dbus:
run_service: false

# os: Fedora
Fedora-31: {}
Fedora-30: {}

# os: CentOS
CentOS Linux-8: {}
CentOS Linux-7: {}
CentOS-6:
dbus:
run_service: false

# os: Amazon
Amazon Linux-2: {}
Amazon Linux AMI-2018:
dbus:
run_service: false

# os: SUSE
Leap-15: {}

# os: FreeBSD
FreeBSD-12: {}

# os: Windows
Windows-8.1: {}

# os: Gentoo
Gentoo-2: {}
6 changes: 6 additions & 0 deletions test/salt/pillar/default.sls
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@ locale:
present:
- "en_US.UTF-8 UTF-8"
- "de_DE.UTF-8 UTF-8"
default:
# Note: On debian systems don't write the second 'UTF-8' here or you will
# experience salt problems like: LookupError: unknown encoding: utf_8_utf_8
# Restart the minion after you corrected this!
name: 'en_US.UTF-8'
requires: 'en_US.UTF-8 UTF-8'
6 changes: 6 additions & 0 deletions test/salt/pillar/redhat.sls
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@
locale:
pkgs:
- glibc-langpack-de
present:
- "en_US.UTF-8 UTF-8"
- "de_DE.UTF-8 UTF-8"
default:
name: 'en_US.UTF-8'
requires: 'en_US.UTF-8 UTF-8'