Skip to content

svn deploy in interactive mode #42

@amateo

Description

@amateo

With the svn define and script included in puppi, svn command is always run in non-interactive mode. This way, you have to include svn username and password in your puppet files, which is not always a good idea.

I have patched these files to include a "interactive" option to the puppet define (which default to false) and svn script, so when it is true, svn command is run in interactive mode.

If you think it could be interesting, this is the patch:

Index: modules/puppi/files/scripts/svn.sh
===================================================================
--- modules/puppi/files/scripts/svn.sh  (revisión: 10271)
+++ modules/puppi/files/scripts/svn.sh  (copia de trabajo)
@@ -24,12 +24,14 @@
     echo "-c <commit> (Optional) Commit to deploy"
     echo "-v <true|false> (Optional) If verbose"
     echo "-k <true|false> (Optional) If .svn dir is kept on deploy_root"
+    echo "-i (Optional) Interactive. Execute svn command in interactive mode"
     echo 
     echo "Examples:"
     echo "svn.sh -a deploy -s $source -d $deploy_root -u $user -gs $svn_subdir -t $tag -b $branch -c $commit -v $bool_verbose -k $bool_keep_svndata"
 }

 verbose="true"
+interactive=false

 # Check Arguments
 while [ $# -gt 0 ]; do
@@ -121,6 +123,14 @@
         keep_svndata=$2
       fi
       shift 2 ;;
+    -i)
+      if [ $interactive ] ; then
+        interactive=$interactive
+      else
+        interactive=$2
+      fi
+      shift 2
+      ;;
     *)
       showhelp
       exit ;;
@@ -133,6 +143,12 @@
   verbosity="--quiet"
 fi

+if [ "$interactive" == "true" ] ; then
+  interactive_arg="--non-interactive"
+else
+  interactive_arg=""
+fi
+
 cd /

 if [ "x$branch" == "xundefined" ] ; then
@@ -172,9 +188,9 @@
 do_install () {
   if [ -d $svndir/.svn ] ; then
     cd $svndir
-    svn up $verbosity $svn_auth --non-interactive
+    svn up $verbosity $svn_auth $interactive_arg
   else
-    svn co $verbosity $real_source $svndir $svn_auth --non-interactive
+    svn co $verbosity $real_source $svndir $svn_auth $interactive_arg
     cd $svndir
   fi

Index: modules/puppi/manifests/project/svn.pp
===================================================================
--- modules/puppi/manifests/project/svn.pp  (revisión: 10271)
+++ modules/puppi/manifests/project/svn.pp  (copia de trabajo)
@@ -131,6 +131,10 @@
 #   (Optional) - If you want to automatically run this puppi deploy when
 #   Puppet runs. Default: 'false'
 #
+# [*interactive*]
+#   (Optional) - If you want to run svn in interactive mode
+#   Default: 'false'
+#
 define puppi::project::svn (
   $source,
   $deploy_root,
@@ -159,6 +163,7 @@
   $backup_retention         = '5',
   $run_checks               = true,
   $auto_deploy              = false,
+  $interactive              = false,
   $enable                   = true ) {

   require puppi
@@ -180,6 +185,7 @@
   $bool_verbose = any2bool($verbose)
   $bool_run_checks = any2bool($run_checks)
   $bool_auto_deploy = any2bool($auto_deploy)
+  $bool_interactive = any2bool($interactive)

 ### INSTALL GIT
   if ($bool_install_svn == true) {
@@ -191,7 +197,6 @@
       enable => $enable ,
     }

-
 ### DEPLOY SEQUENCE
   if ($bool_run_checks == true) {
     puppi::deploy { "${name}-Run_PRE-Checks":
@@ -252,7 +257,7 @@
     puppi::deploy { "${name}-Deploy_Files":
       priority  => '40' ,
       command   => 'svn.sh' ,
-      arguments => "-a deploy -s ${source} -d ${deploy_root} -u ${user} -gs ${svn_subdir} -su ${svn_user} -sp ${svn_password} -t ${tag} -b ${branch} -c ${commit} -v ${bool_verbose} -k ${bool_keep_svndata}" ,
+      arguments => "-a deploy -s ${source} -d ${deploy_root} -u ${user} -gs ${svn_subdir} -su ${svn_user} -sp ${svn_password} -t ${tag} -b ${branch} -c ${commit} -v ${bool_verbose} -k ${bool_keep_svndata} -i ${bool_interactive}" ,
       user      => 'root' ,
       project   => $name ,
       enable    => $enable ,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions