From e40fde92fc95bed5e97e0715413b6a21f5780a42 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 20 Jan 2014 14:40:54 +0100 Subject: [PATCH 1/7] allow releases from non-master branch, if the person knows what he does Signed-off-by: Nico Schottelius --- bin/build-helper | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/build-helper b/bin/build-helper index b97528f1..389e7696 100755 --- a/bin/build-helper +++ b/bin/build-helper @@ -207,7 +207,13 @@ eof # Ensure we are on the master branch if [ "$(git rev-parse --abbrev-ref HEAD)" != "master" ]; then echo "Releases are happening from the master branch, aborting" - exit 1 + + echo "Enter the magic word to release anyway" + read magicword + + if [ "$magicword" != "iknowwhatido" ]; then + exit 1 + fi fi # Ensure version branch exists From f034ed60279370314fe4d2c063a45e59f5ca3c34 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 20 Jan 2014 14:43:48 +0100 Subject: [PATCH 2/7] do not merge, if not coming from the master branch Signed-off-by: Nico Schottelius --- bin/build-helper | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/bin/build-helper b/bin/build-helper index 389e7696..6210b907 100755 --- a/bin/build-helper +++ b/bin/build-helper @@ -205,25 +205,30 @@ eof fi # Ensure we are on the master branch + masterbranch=yes if [ "$(git rev-parse --abbrev-ref HEAD)" != "master" ]; then echo "Releases are happening from the master branch, aborting" echo "Enter the magic word to release anyway" read magicword - if [ "$magicword" != "iknowwhatido" ]; then + if [ "$magicword" = "iknowwhatido" ]; then + masterbranch=no + else exit 1 fi fi - # Ensure version branch exists - if ! git rev-parse --verify refs/heads/$target_branch 2>/dev/null; then - git branch "$target_branch" - fi + if [ "$masterbranch" = yes ]; then + # Ensure version branch exists + if ! git rev-parse --verify refs/heads/$target_branch 2>/dev/null; then + git branch "$target_branch" + fi - # Merge master branch into version branch - git checkout "$target_branch" - git merge master + # Merge master branch into version branch + git checkout "$target_branch" + git merge master + fi # Verify that after the merge everything works "$0" check-date From 8ed5f85f9d5559f55ea41357d61217d3405c0610 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 20 Jan 2014 14:48:05 +0100 Subject: [PATCH 3/7] do not change to the masterbranch... Signed-off-by: Nico Schottelius --- bin/build-helper | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/build-helper b/bin/build-helper index 6210b907..bfd7d31c 100755 --- a/bin/build-helper +++ b/bin/build-helper @@ -247,8 +247,10 @@ eof "$0" release-git-tag # Also merge back the version branch - git checkout master - git merge "$target_branch" + if [ "$masterbranch" = yes ]; then + git checkout master + git merge "$target_branch" + fi # Publish git changes make pub From 7eabdc3cf9af4552cca183c5c4cc4e540b7a1494 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 20 Jan 2014 14:56:41 +0100 Subject: [PATCH 4/7] ignore pypi-release marker Signed-off-by: Nico Schottelius --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 63f8076a..baf9b6f2 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,4 @@ build .lock-* .git-current-branch .lock* +.pypi-release From 4bd6158260f21b3da8b355edeb5cb2a8c7e19022 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 20 Jan 2014 16:19:41 +0100 Subject: [PATCH 5/7] add log from today Signed-off-by: Nico Schottelius --- docs/dev/logs/2014-01-20.environments | 44 +++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 docs/dev/logs/2014-01-20.environments 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 + From 64f4cff3cb60eccb05eb385ec7e6b09f2292ff20 Mon Sep 17 00:00:00 2001 From: Daniel Heule Date: Mon, 20 Jan 2014 20:30:37 +0100 Subject: [PATCH 6/7] Shell selection support via ENV CDIST_LOCAL_SHELL for local scripts CDIST_REMOTE_SHELL for remote scripts --- cdist/exec/local.py | 2 +- cdist/exec/remote.py | 2 +- cdist/shell.py | 5 +---- docs/man/man1/cdist.text | 14 ++++++++++---- 4 files changed, 13 insertions(+), 10 deletions(-) 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/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 From 6746ba827911b20e0f841ac53127ee4458b80d2c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 21 Jan 2014 09:16:45 +0100 Subject: [PATCH 7/7] ++changes Signed-off-by: Nico Schottelius --- docs/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changelog b/docs/changelog index f43131a1..74220980 100644 --- a/docs/changelog +++ b/docs/changelog @@ -6,6 +6,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)