]> git.donarmstrong.com Git - dsa-puppet.git/commitdiff
Ship list of mirrors with puppet too
authorPeter Palfrader <peter@palfrader.org>
Sat, 8 Dec 2012 17:09:46 +0000 (18:09 +0100)
committerPeter Palfrader <peter@palfrader.org>
Sat, 8 Dec 2012 17:10:44 +0000 (18:10 +0100)
modules/roles/files/static-mirroring/static-master-run
modules/roles/files/static-mirroring/static-master-update-component
modules/roles/manifests/static_master.pp
modules/roles/templates/static-clients.conf.erb [new file with mode: 0644]

index 24ea3e11b1a02d42c4896c06e49a0e86952f7d40..0d7003d45500e6fc98691c8da6b179f4b2509cdf 100755 (executable)
@@ -15,9 +15,12 @@ subdirs = { 'master': 'master',       # where updates from off-site end up going
 serialname = '.serial'
 
 clients = []
-with open('/home/staticsync/etc/static-clients') as f:
+with open('/etc/static-clients.conf') as f:
   for line in f:
-    clients.append(line.strip())
+    line = line.strip()
+    if line == "": continue
+    if line.startswith('#'): continue
+    clients.append(line)
 
 def log(m):
   t = time.strftime("[%Y-%m-%d %H:%M:%S]", time.gmtime())
index 64bca49280f45ae41c6b718659fbd1e63b87b683..2f1742bec4815fc7395b81e1bd67590abbce3a2d 100755 (executable)
@@ -29,7 +29,7 @@
 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
-componentlist=/home/staticsync/etc/static-components
+componentlist=/etc/static-components.conf
 base=/home/staticsync/static-master/master
 
 set -e
index bb722be7d1602bca9224879a70f38d08b1f0b9bb..4f982bd3947f200939db34b7cee6bbefe45c7416 100644 (file)
@@ -19,6 +19,9 @@ class roles::static_master inherits roles::static_base {
         '/etc/static-components.conf':
             source  => "puppet:///modules/roles/static-mirroring/static-components.conf",
             ;
+        '/etc/static-clients.conf':
+            content => template('roles/static-clients.conf.erb'),
+            ;
     }
 }
 # vim:set et:
diff --git a/modules/roles/templates/static-clients.conf.erb b/modules/roles/templates/static-clients.conf.erb
new file mode 100644 (file)
index 0000000..edbf313
--- /dev/null
@@ -0,0 +1,19 @@
+##
+## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
+##
+
+<%=
+
+mirrors = []
+scope.lookupvar('site::localinfo').keys.sort.each do |node|
+    if scope.lookupvar('site::localinfo')[node]['static_mirror']
+        mirrors << node
+    end
+end
+
+
+mirrors.join("\n")
+# vim:set et:
+# vim:set sts=4 ts=4:
+# vim:set shiftwidth=4:
+%>