Skip to content

/ Zope / gocept svn checkins / Archive / 2008 / 2008-10 / SVN: r6767 - in gocept.infrastructure/testing/puppet: modules/app_admin/manifests modules/app_admin/templates modules/net_analyzer/manifests modules/net_analyzer/templates plugins/puppet/parser/functions

[ << ] [ >> ]

[ SVN: r6764 - in gocept.infrastructure/testing/pupp... ] [ SVN: r6768 - in gocept.infrastructure/production: ... ]

SVN: r6767 - in gocept.infrastructure/testing/puppet: modules/app_admin/manifests modules/app_admin/templates modules/net_analyzer/manifests modules/net_analyzer/templates plugins/puppet/parser/functions
Christian Kauhaus <kc(at)gocept.com>
2008-10-06 13:33:19 [ FULL ]
Author: ckauhaus
Date: Mon Oct  6 13:33:18 2008
New Revision: 6767

Log:
dynamic environment generation


Added:
  
gocept.infrastructure/testing/puppet/plugins/puppet/parser/functions/environments.rb
Modified:
   gocept.infrastructure/testing/puppet/modules/app_admin/manifests/puppet.pp
  
gocept.infrastructure/testing/puppet/modules/app_admin/templates/puppet.conf.erb
  
gocept.infrastructure/testing/puppet/modules/net_analyzer/manifests/defines.pp
  
gocept.infrastructure/testing/puppet/modules/net_analyzer/templates/nagios_host.cfg.erb

Modified:
gocept.infrastructure/testing/puppet/modules/app_admin/manifests/puppet.pp
==============================================================================
---
gocept.infrastructure/testing/puppet/modules/app_admin/manifests/puppet.pp	(original)
+++
gocept.infrastructure/testing/puppet/modules/app_admin/manifests/puppet.pp	Mon
Oct  6 13:33:18 2008
(at)(at) -5,6 +5,8 (at)(at)
     include tmpwatch
 
     $puppet_root = "/home/puppet"
+    $envlist = environments("name", $puppet_root)
+    $envpaths = environments("path", $puppet_root)
     $cron_minute = fqdn_rand(30)
 
     package { "puppet": }

Modified:
gocept.infrastructure/testing/puppet/modules/app_admin/templates/puppet.conf.erb
==============================================================================
---
gocept.infrastructure/testing/puppet/modules/app_admin/templates/puppet.conf.erb	(original)
+++
gocept.infrastructure/testing/puppet/modules/app_admin/templates/puppet.conf.erb	Mon
Oct  6 13:33:18 2008
(at)(at) -1,7 +1,7 (at)(at)
 [main]
     server = <%= scope.lookupvar('location::puppetmaster') %>
 
-    environments = production,testing,hotfix
+    environments = <%= envlist %>
 
     # Where Puppet stores dynamic and growing data.
     # The default value is '/var/puppet'.
(at)(at) -30,14 +30,11 (at)(at)
     # Whether plugins should be synced with the central server.
     pluginsync = true
 
-<% for env in ["production", "testing", "hotfix"] %>
-[<%= env %>]
-    # Where the manifest is kept
-    manifestdir = <%= puppet_root %>/<%= env %>/puppet/manifests
-    manifest = <%= puppet_root %>/<%= env
%>/puppet/manifests/site.pp
-
-    # Where modules are kept
-    modulepath = <%= puppet_root %>/<%= env
%>/puppet/modules:/usr/share/puppet/modules
+<% for path in envpaths.split %>
+[<%= File.basename(path) %>]
+    manifestdir = <%= path %>/puppet/manifests
+    manifest = <%= path %>/puppet/manifests/site.pp
+    modulepath = <%= path %>/puppet/modules:/usr/share/puppet/modules
 
 <% end %>
 

Modified:
gocept.infrastructure/testing/puppet/modules/net_analyzer/manifests/defines.pp
==============================================================================
---
gocept.infrastructure/testing/puppet/modules/net_analyzer/manifests/defines.pp	(original)
+++
gocept.infrastructure/testing/puppet/modules/net_analyzer/manifests/defines.pp	Mon
Oct  6 13:33:18 2008
(at)(at) -1,11 +1,11 (at)(at)
 # Macros for easy definition of Nagios checks
 
-define net_analyzer::host($shortname, $alias = false) {
+define net_analyzer::host($shortname, $hostalias = false) {
     $directory = "/etc/nagios/hosts/$fqdn"
     $address = $title
-    $hostalias = $alias ? {
+    $alias_ = $hostalias ? {
         false => $fqdn,
-        default => $alias
+        default => $hostalias
     }
 
     (at)(at)file {

Modified:
gocept.infrastructure/testing/puppet/modules/net_analyzer/templates/nagios_host.cfg.erb
==============================================================================
---
gocept.infrastructure/testing/puppet/modules/net_analyzer/templates/nagios_host.cfg.erb	(original)
+++
gocept.infrastructure/testing/puppet/modules/net_analyzer/templates/nagios_host.cfg.erb	Mon
Oct  6 13:33:18 2008
(at)(at) -1,6 +1,6 (at)(at)
 define host {
     host_name <%= shortname %>
-    alias <%= hostalias %>
+    alias <%= alias_ %>
     address <%= address %>
     use generic-host
 }

Added:
gocept.infrastructure/testing/puppet/plugins/puppet/parser/functions/environments.rb
==============================================================================
--- (empty file)
+++
gocept.infrastructure/testing/puppet/plugins/puppet/parser/functions/environments.rb	Mon
Oct  6 13:33:18 2008
(at)(at) -0,0 +1,22 (at)(at)
+module Puppet::Parser::Functions
+  # Provide a list of environments found in puppet_root. Output format depends
+  # on the value of +fmt+:
+  # :name - comma-separated list of blank environment names, e.g.
+  #         foo,bar,baz
+  # :path - space-separated list of pathname components, e.g.
+  #         foo feature/bar feature/baz
+  newfunction(:environments, :type => :rvalue) do |args|
+    fmt = args[0].to_sym
+    root = args[1]
+    envs = (["#{root}/production", "#{root}/hotfix", "#{root}/testing"] + \
+      Dir["#{root}/feature/*/"]).map { |e| e.chomp('/') }
+    case fmt 
+    when :name then
+        envs.map { |e| File.basename(e) }.join(',')
+    when :path then
+        envs.join(' ')
+    else
+        raise "environments: unsupported output format #{fmt}"
+    end
+  end
+end

SVN: r6776 - in gocept.infrastructure/testing/puppet: modules/app_admin/templates plugins/puppet/parser/functions
Christian Kauhaus <kc(at)gocept.com>
2008-10-06 14:48:32 [ FULL ]
Author: ckauhaus
Date: Mon Oct  6 14:48:31 2008
New Revision: 6776

Log:
implemented flat feature namespace


Modified:
  
gocept.infrastructure/testing/puppet/modules/app_admin/templates/conf.d_puppetmaster.erb
  
gocept.infrastructure/testing/puppet/modules/app_admin/templates/fileserver.conf.erb
  
gocept.infrastructure/testing/puppet/modules/app_admin/templates/puppet.conf.erb
  
gocept.infrastructure/testing/puppet/plugins/puppet/parser/functions/environments.rb

Modified:
gocept.infrastructure/testing/puppet/modules/app_admin/templates/conf.d_puppetmaster.erb
==============================================================================
---
gocept.infrastructure/testing/puppet/modules/app_admin/templates/conf.d_puppetmaster.erb	(original)
+++
gocept.infrastructure/testing/puppet/modules/app_admin/templates/conf.d_puppetmaster.erb	Mon
Oct  6 14:48:31 2008
(at)(at) -2,7 +2,7 (at)(at)
 PUPPETMASTER_PID_DIR="/var/run/puppet"
 
 # Location of the main manifest
-PUPPETMASTER_MANIFEST="/home/puppet/<%= environment
%>/puppet/manifests/site.pp"
+PUPPETMASTER_MANIFEST="<%= puppet_root %>/<%= environment
%>/puppet/manifests/site.pp"
 
 # Where to log general messages to.
 # Specify syslog to send log messages to the system log.

Modified:
gocept.infrastructure/testing/puppet/modules/app_admin/templates/fileserver.conf.erb
==============================================================================
---
gocept.infrastructure/testing/puppet/modules/app_admin/templates/fileserver.conf.erb	(original)
+++
gocept.infrastructure/testing/puppet/modules/app_admin/templates/fileserver.conf.erb	Mon
Oct  6 14:48:31 2008
(at)(at) -12,7 +12,7 (at)(at)
 #  allow 192.168.0.0/24
 
 [plugins]
-    path /home/puppet/<%= environment %>/puppet/plugins
+    path <%= puppet_root %>/<%= environment %>/puppet/plugins
     allow 127.0.0.0/8
     allow 192.168.0.0/16
     allow 195.62.106.0/25

Modified:
gocept.infrastructure/testing/puppet/modules/app_admin/templates/puppet.conf.erb
==============================================================================
---
gocept.infrastructure/testing/puppet/modules/app_admin/templates/puppet.conf.erb	(original)
+++
gocept.infrastructure/testing/puppet/modules/app_admin/templates/puppet.conf.erb	Mon
Oct  6 14:48:31 2008
(at)(at) -39,7 +39,7 (at)(at)
 <% end %>
 
 [puppetd]
-    environment = <%= environment %>
+    environment = <%= File.basename(environment) %>
 
     # The file in which puppetd stores a list of the classes
     # associated with the retrieved configuratiion.  Can be loaded in

Modified:
gocept.infrastructure/testing/puppet/plugins/puppet/parser/functions/environments.rb
==============================================================================
---
gocept.infrastructure/testing/puppet/plugins/puppet/parser/functions/environments.rb	(original)
+++
gocept.infrastructure/testing/puppet/plugins/puppet/parser/functions/environments.rb	Mon
Oct  6 14:48:31 2008
(at)(at) -9,7 +9,7 (at)(at)
     fmt = args[0].to_sym
     root = args[1]
     envs = (["#{root}/production", "#{root}/hotfix", "#{root}/testing"] + \
-      Dir["#{root}/feature/*/"]).map { |e| e.chomp('/') }
+      Dir["#{root}/feature_*/"]).map { |e| e.chomp('/') }
     case fmt 
     when :name then
         envs.map { |e| File.basename(e) }.join(',')

MailBoxer