From 4db3a22f49abed6e2b651779506534a0a856e35d Mon Sep 17 00:00:00 2001
From: Thomas Bellman <bellman@nsc.liu.se>
Date: Fri, 13 Jan 2012 10:15:00 +0100
Subject: [PATCH] Sort dsm.opt and dsm.sys based on resource title.

Use the tsmclient resource title to sort entries in dsm.opt and dsm.sys
instead of the symbolic server name.  This can be used to select the
default server, by making sure that resource's title is lexically after
all other tsmclient resources.
---
 manifests/init.pp | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/manifests/init.pp b/manifests/init.pp
index bd8497e..d8e2d48 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -42,8 +42,11 @@ import "nsc-puppet-utils"
  * names), in which case dsm.sys and dsm.opt will contain all the
  * declared servers with their respective configurations.  Unconfiguring
  * a server is done by just not declaring it in the manifests anymore.
- * There is however no way of declaring which of the servers should be
- * the default server.
+ *
+ * The server entries in dsm.opt and dsm.sys are ordered lexically based
+ * on the tsmclient resource titles.  This can be exploited to select
+ * the default server (the last one wins), by explicitly setting the
+ * name parameter.
  *
  * The caller must provide a class named 'tsmclient::siteconfig'
  * for configuration, defining the following class variables:
@@ -204,9 +207,9 @@ define tsmclient($serveraddress, $nodename=$fqdn,
 	    require => Package['TIVsm-BA'], notify => Service['dsmcad'];
     }
     concat_part {
-	"${tsmdir}/bin/dsm.opt/${tsm_servername}":
+	"${tsmdir}/bin/dsm.opt/${title}":
 	    content => template('tsmclient/dsm.opt.erb');
-	"${tsmdir}/bin/dsm.sys/${tsm_servername}":
+	"${tsmdir}/bin/dsm.sys/${title}":
 	    content => template('tsmclient/dsm.sys.erb');
      }
 }
-- 
GitLab