diff --git a/bundles/basic/items.py b/bundles/basic/items.py index e37b684..c414fe5 100644 --- a/bundles/basic/items.py +++ b/bundles/basic/items.py @@ -13,14 +13,20 @@ files = { '/etc/htoprc.global': { 'source': 'htoprc', }, - '/etc/locale.gen': { - 'content_type': 'mako', + '/etc/motd': {}, +} + +locale_needs = set() +for locale in sorted(node.metadata['locale']['installed']): + actions[f'ensure_locale_{locale}_is_enabled'] = { + 'command': f"sed -i '/{locale}/s/^# *//g' /etc/locale.gen", + 'unless': f"grep -e '^{locale}' /etc/locale.gen", 'triggers': { 'action:locale-gen', }, - }, - '/etc/motd': {}, -} + 'needs': locale_needs, + } + locale_needs = {f'action:ensure_locale_{locale}_is_enabled'} actions = { 'locale-gen': {