nacl icon indicating copy to clipboard operation
nacl copied to clipboard

Adding an Id context manager

Open fgansevl opened this issue 10 years ago • 0 comments

Hi, first: awesome work with NaCL/PyObjects I was pondering myself about a Pythonic interface to Puppet when I came across salt/nacl

according to the docs you don't have an interface for reactor files yet.

My suggestion could help you with that

first, introducing the 'Id' context manager which maps to the highstate id key, so the apache yaml example:

apache:
    pkg.installed
    service.running

would translate to

with Id('apache'):
    Pkg.installed()
    Service.running()

as you can see, it translates almost directly to the yaml example

when writing reactor files, you could do something like the following

sync_grains:
    cmd.saltutil.sync_grains:
        - tgt: {{ data['id'] }}

would become:

with Id('sync_grains'):
    Cmd.saltutil.sync_grains(tgt = data['id'])

ofcourse there are a lot of details to work out, but does this look 'workable' ?

Fred.

fgansevl avatar Jul 24 '14 19:07 fgansevl