forked from ungleich-public/cdist
If script is executable then execute it, if not then assume it is a shell script.
This commit is contained in:
parent
62378dc8b9
commit
9aa4465718
2 changed files with 14 additions and 2 deletions
|
@ -237,7 +237,13 @@ class Local(object):
|
||||||
Return the output as a string.
|
Return the output as a string.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
if os.access(script, os.X_OK):
|
||||||
|
self.log.debug('%s is executable, running it', script)
|
||||||
|
command=[script]
|
||||||
|
else:
|
||||||
command = [os.environ.get('CDIST_LOCAL_SHELL', "/bin/sh"), "-e"]
|
command = [os.environ.get('CDIST_LOCAL_SHELL', "/bin/sh"), "-e"]
|
||||||
|
self.log.debug('%s is NOT executable, running it with %s',
|
||||||
|
script, " ".join(command))
|
||||||
command.append(script)
|
command.append(script)
|
||||||
|
|
||||||
return self.run(command=command, env=env, return_output=return_output,
|
return self.run(command=command, env=env, return_output=return_output,
|
||||||
|
|
|
@ -79,6 +79,12 @@ two underscores (__) to prevent collisions with other executables in $PATH.
|
||||||
|
|
||||||
To implement a new type, create the directory **cdist/conf/type/__NAME**.
|
To implement a new type, create the directory **cdist/conf/type/__NAME**.
|
||||||
|
|
||||||
|
Type manifest and gencode can be written in any language. They just need to be
|
||||||
|
executable and have a proper shebang. If they are not executable then cdist assumes
|
||||||
|
they are written in shell so they are executed using '/bin/sh -e' or 'CDIST_LOCAL_SHELL'.
|
||||||
|
|
||||||
|
For executable shell code it is suggested that shebang is '#!/bin/sh -e'.
|
||||||
|
|
||||||
|
|
||||||
Defining parameters
|
Defining parameters
|
||||||
-------------------
|
-------------------
|
||||||
|
|
Loading…
Reference in a new issue