-
-
Save borgstrom/9005585 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
try: | |
from nacl.auto import * | |
from nacl.state import default_registry | |
HAS_NACL = True | |
except ImportError: | |
HAS_NACL = False | |
__virtualname__ = 'nacl' | |
log = logging.getLogger(__virtualname__) | |
def __virtual__(): | |
if HAS_NACL: | |
log.info("NaCl renderer available") | |
return HAS_NACL | |
def render(template, saltenv='base', sls='', | |
tmplpath=None, rendered_sls=None, **kwargs): | |
pillar = __pillar__ | |
grains = __grains__ | |
salt = __salt__ | |
exec(template.read()) | |
return default_registry.salt_data() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!nacl | |
Service.running(pillar.get('service', 'nginx')) | |
#this is totally contrived | |
interfaces = salt['network.interfaces']() | |
File.exists('interface-tmp', names=['/tmp/interface-{}'.format(i) for i in interfaces.keys()]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment