From f9cac131c9c4e125b85cc6b152839bb97b461383 Mon Sep 17 00:00:00 2001
From: Steven Armstrong <steven@icarus.ethz.ch>
Date: Tue, 10 Dec 2013 11:13:25 +0100
Subject: [PATCH] add parameter to run curl in insecure mode: thanks Thorsten!

Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
---
 cdist/conf/type/__install_stage/gencode-remote    | 5 ++++-
 cdist/conf/type/__install_stage/man.text          | 9 ++++++++-
 cdist/conf/type/__install_stage/parameter/boolean | 1 +
 3 files changed, 13 insertions(+), 2 deletions(-)
 create mode 100644 cdist/conf/type/__install_stage/parameter/boolean

diff --git a/cdist/conf/type/__install_stage/gencode-remote b/cdist/conf/type/__install_stage/gencode-remote
index bbc27679..3b83ea61 100755
--- a/cdist/conf/type/__install_stage/gencode-remote
+++ b/cdist/conf/type/__install_stage/gencode-remote
@@ -22,8 +22,11 @@ uri="$(cat "$__object/parameter/uri" 2>/dev/null \
    || echo "$__object_id")"
 target="$(cat "$__object/parameter/target")"
 
-
 [ "$__debug" = "yes" ] && curl="curl" || curl="curl -s"
 [ "$__debug" = "yes" ] && tar="tar -xvzp" || tar="tar -xzp"
 
+if [ -f "$__object/parameter/insecure" ] ; then
+   curl="$curl -k"
+fi
+
 echo "$curl '$uri' | $tar -C '$target'"
diff --git a/cdist/conf/type/__install_stage/man.text b/cdist/conf/type/__install_stage/man.text
index 7abc77e8..289c8621 100644
--- a/cdist/conf/type/__install_stage/man.text
+++ b/cdist/conf/type/__install_stage/man.text
@@ -30,6 +30,12 @@ target::
    where to unpack the tarball to. Defaults to /target.
 
 
+BOOLEAN PARAMETERS
+------------------
+insecure::
+   run curl in insecure mode so it does not check the servers ssl certificate
+
+
 EXAMPLES
 --------
 
@@ -37,6 +43,7 @@ EXAMPLES
 __install_stage --uri tftp:///path/to/stage.tgz
 __install_stage --uri http://path/to/stage.tgz --target /mnt/foobar
 __install_stage --uri file:///path/to/stage.tgz --target /target
+__install_stage --uri https://path/to/stage.tgz --target /mnt/foobar --insecure
 --------------------------------------------------------------------------------
 
 
@@ -47,5 +54,5 @@ SEE ALSO
 
 COPYING
 -------
-Copyright \(C) 2011 Steven Armstrong. Free use of this software is
+Copyright \(C) 2011 - 2013 Steven Armstrong. Free use of this software is
 granted under the terms of the GNU General Public License version 3 (GPLv3).
diff --git a/cdist/conf/type/__install_stage/parameter/boolean b/cdist/conf/type/__install_stage/parameter/boolean
new file mode 100644
index 00000000..e86bf3fc
--- /dev/null
+++ b/cdist/conf/type/__install_stage/parameter/boolean
@@ -0,0 +1 @@
+insecure