Last active
August 29, 2015 13:56
-
-
Save mgwilliams/8986670 to your computer and use it in GitHub Desktop.
This file contains hidden or 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: | |
import nacl.state | |
from nacl.auto import * | |
from nacl.run import run | |
HAS_NACL = True | |
except ImportError: | |
HAS_NACL = False | |
# Set up logging | |
log = logging.getLogger(__name__) | |
__virtualname__ = 'nacl' | |
def __virtual__(): | |
if not HAS_NACL: | |
log.info('NACL Renderer Loaded') | |
return False | |
return True | |
def render(template, saltenv='base', sls='', tmplpath=None, rendered_sls=None, **kws): | |
log.warning(kws) | |
pillar = __pillar__ | |
grains = __grains__ | |
salt = __salt__ | |
exec(template.read()) | |
return run() |
This file contains hidden or 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