diff --git a/cdist/exec/local.py b/cdist/exec/local.py index 4233b874..2f75ffd4 100644 --- a/cdist/exec/local.py +++ b/cdist/exec/local.py @@ -188,7 +188,7 @@ class Local(object): Return the output as a string. """ - command = ["/bin/sh", "-e"] + command = [ os.environ.get('CDIST_LOCAL_SHELL',"/bin/sh") , "-e"] command.append(script) return self.run(command=command, env=env, return_output=return_output, message_prefix=message_prefix) diff --git a/cdist/exec/remote.py b/cdist/exec/remote.py index 7c807092..9b7d5d1c 100644 --- a/cdist/exec/remote.py +++ b/cdist/exec/remote.py @@ -113,7 +113,7 @@ class Remote(object): """ - command = ["/bin/sh", "-e"] + command = [ os.environ.get('CDIST_REMOTE_SHELL',"/bin/sh") , "-e"] command.append(script) return self.run(command, env, return_output) diff --git a/cdist/shell.py b/cdist/shell.py index ebf9f434..8ca68115 100644 --- a/cdist/shell.py +++ b/cdist/shell.py @@ -45,10 +45,7 @@ class Shell(object): """Select shell to execute, if not specified by user""" if not self.shell: - if 'SHELL' in os.environ: - self.shell = os.environ['SHELL'] - else: - self.shell = "/bin/sh" + self.shell = os.environ.get('SHELL',"/bin/sh") def _init_files_dirs(self): self.local.create_files_dirs() diff --git a/docs/changelog b/docs/changelog index 98260564..8478c3eb 100644 --- a/docs/changelog +++ b/docs/changelog @@ -10,6 +10,7 @@ Changelog 3.0.3: * Core: Enhance error message when requirement is missing object id + * Core: Add environment variable to select shell for executing scripts (Daniel Heule) * Explorer hostname: Return host name by using uname -n * New Type: __hostname (Steven Armstrong) diff --git a/docs/dev/logs/2014-01-20.environments b/docs/dev/logs/2014-01-20.environments new file mode 100644 index 00000000..88fe42b9 --- /dev/null +++ b/docs/dev/logs/2014-01-20.environments @@ -0,0 +1,44 @@ +raw quote from irc + +16:00 < sar> telmich: btw, ich denke nicht dass man install schon zu gross bewerben + sollte +16:00 < telmich> sar: ack +16:00 < sar> telmich: imho sollten wir erst die cdist environments implementieren, + install waere dann eines davon +16:00 < sar> config ein anderes +16:01 < sar> foobar noch ein anderes +16:01 < sar> es macht einfach keinen sinn auf type ebene install vs nicht-install zu + unterscheiden +16:02 < telmich> sar: environments sind bei mir noch nicht ganz im gehirn (ganicht?) + angelangt - hast du (nochmal?) kurz eine idee, was du damit meinst? +16:02 < sar> telmich: wenn man cdist anschaut, dann macht es eigentlich folgendes: +16:03 < sar> - definiere objekte mit hilfe von types +16:03 < sar> - deps zwischen objekten +16:03 < sar> - queue von objekten abarbeiten und auf $etwas anwenden +16:03 < sar> das ist alles +16:04 < sar> telmich: das ist eigentlich ziemlich generisch +16:04 < sar> telmich: fuer mich wuerde es sich hier anbieten das auch so zu + abstrahieren +16:05 < sar> telmich: ein environment (nenn das mal so weil kein besserer name zzt) + koennte das wie $objekt auf $etwas bestimmen +16:05 < sar> telmich: und auch was fuer types es in diesem environment gibt +16:06 < telmich> sar: klingt gut +16:06 < sar> telmich: e.g. es gibt ein environment fuer config -> was wir jetzt haben +16:06 < sar> eins fuer install -> += was im install branch ist (nur die types), den + python code brauchts nacher nicht mehr +16:07 < sar> eins fuer cisco-switch -> hat types um mit cisco zu spielen +16:07 < sar> usw +16:07 < sar> ein environment hat auch eigene remote-{exec,copy} scripte +16:08 < sar> und vielleicht globale explorer, vielleicht auch nicht +16:08 < sar> ein enviroment ist ein cconfig style directory +16:09 < sar> wo man cdist drueber laufen laesst +16:09 < sar> so was in der art +16:13 < telmich> sar: hmmja...klingt gut +16:15 < telmich> vielleicht etwas für cdist 4 oder cdist 5 :-) +16:15 < telmich> aber ich denke auf jeden fall als grundgedanke behaltbar +16:16 < telmich> ok für dich, wenn ich den chat ins docs/dev/logs kopiere als + erinnerungs +16:16 < telmich> s/s$/?/? +16:16 < telmich> s/?$// +16:20 < sar> klar + diff --git a/docs/man/man1/cdist.text b/docs/man/man1/cdist.text index de50a4ce..e8c12991 100644 --- a/docs/man/man1/cdist.text +++ b/docs/man/man1/cdist.text @@ -127,10 +127,16 @@ usage: __git --source SOURCE [--state STATE] [--branch BRANCH] ENVIRONMENT ----------- TMPDIR, TEMP, TMP:: - Setup the base directory for the temporary directory. - See http://docs.python.org/py3k/library/tempfile.html for - more information. This is rather useful, if the standard - directory used does not allow executables. + Setup the base directory for the temporary directory. + See http://docs.python.org/py3k/library/tempfile.html for + more information. This is rather useful, if the standard + directory used does not allow executables. + +CDIST_LOCAL_SHELL:: + Selects shell for local script execution, defaults to /bin/sh + +CDIST_REMOTE_SHELL:: + Selects shell for remote scirpt execution, defaults to /bin/sh EXIT STATUS