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

Add gitfs support for Thorium #47187

Merged
merged 2 commits into from
Apr 23, 2018
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
61 changes: 61 additions & 0 deletions doc/topics/thorium/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,67 @@ Example ``thorium_roots`` configuration:
base:
- /etc/salt/thorium

It is also possible to use gitfs with Thorium,
using the ``thoriumenv`` or ``thorium_top`` settings.

Example using ``thorium_top``:

.. code-block:: yaml

thorium_top: salt://thorium/top.sls
gitfs_provider: pygit2

gitfs_remotes:
- git@github.com:user/repo.git:
- name: salt-backend
- root: salt
- base: master
- git@github.com:user/repo.git:
- name: thorium-backend
- root: thorium
- base: master
- mountpoint: salt://thorium

.. note::

When using this method don't forget to prepend the mountpoint to files served by this repo,
for example ``top.sls``:

.. code-block:: yaml

base:
'*':
- thorium.key_clean

Example using ``thoriumenv``:

.. code-block:: yaml

thoriumenv: thorium
gitfs_provider: pygit2

gitfs_remotes:
- git@github.com:user/repo.git:
- name: salt-backend
- root: salt
- base: master
- git@github.com:user/repo.git:
- name: thorium-backend
- root: thorium
- saltenv:
- thorium:
- ref: master

.. note::

When using this method all state will run under the defined environment,
for example ``top.sls``:

.. code-block:: yaml

thorium:
'*':
- key_clean

The Thorium top.sls File
------------------------
Expand Down
10 changes: 10 additions & 0 deletions salt/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1192,6 +1192,12 @@ def _gather_buffer_space():

# Enable calling ssh minions from the salt master
'enable_ssh_minions': bool,

# Thorium saltenv
'thoriumenv': (type(None), six.string_types),

# Thorium top file location
'thorium_top': six.string_types,
}

# default configurations
Expand Down Expand Up @@ -1255,6 +1261,8 @@ def _gather_buffer_space():
'startup_states': '',
'sls_list': [],
'top_file': '',
'thoriumenv': None,
'thorium_top': 'top.sls',
'thorium_interval': 0.5,
'thorium_roots': {
'base': [salt.syspaths.BASE_THORIUM_ROOTS_DIR],
Expand Down Expand Up @@ -1530,6 +1538,8 @@ def _gather_buffer_space():
'decrypt_pillar_delimiter': ':',
'decrypt_pillar_default': 'gpg',
'decrypt_pillar_renderers': ['gpg'],
'thoriumenv': None,
'thorium_top': 'top.sls',
'thorium_interval': 0.5,
'thorium_roots': {
'base': [salt.syspaths.BASE_THORIUM_ROOTS_DIR],
Expand Down
2 changes: 2 additions & 0 deletions salt/thorium/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ def __init__(
self.pillar = pillar
self.pillar_keys = pillar_keys
opts['file_roots'] = opts['thorium_roots']
opts['saltenv'] = opts['thoriumenv']
opts['state_top'] = opts['thorium_top']
opts['file_client'] = 'local'
self.opts = opts
if opts.get('minion_data_cache'):
Expand Down