[katello-devel] [PATCH 1/2] Add thumbslug configuration for headpin

James Bowes jbowes at redhat.com
Thu Nov 24 13:35:13 UTC 2011


---

This patch and the next are for master.

I don't have commit access to katello (afaik), so if someone could
commit these changes for me (assuming they're ok), that would be awesome.

-James

 puppet/modules/candlepin/manifests/params.pp       |    7 +++++--
 .../templates/etc/candlepin/candlepin.conf.erb     |    8 ++++++--
 puppet/modules/katello/manifests/config.pp         |   14 +++++++-------
 puppet/modules/katello/manifests/init.pp           |    1 +
 puppet/modules/katello/manifests/install.pp        |    4 ++--
 puppet/modules/katello/manifests/service.pp        |    2 +-
 puppet/modules/thumbslug/manifests/config.pp       |    6 ++++++
 puppet/modules/thumbslug/manifests/init.pp         |    5 +++++
 puppet/modules/thumbslug/manifests/install.pp      |   17 +++++++++++++++++
 puppet/modules/thumbslug/manifests/params.pp       |    5 +++++
 puppet/modules/thumbslug/manifests/service.pp      |    6 ++++++
 .../templates/etc/thumbslug/thumbslug.conf.erb     |    3 +++
 12 files changed, 64 insertions(+), 14 deletions(-)
 create mode 100644 puppet/modules/thumbslug/manifests/config.pp
 create mode 100644 puppet/modules/thumbslug/manifests/init.pp
 create mode 100644 puppet/modules/thumbslug/manifests/install.pp
 create mode 100644 puppet/modules/thumbslug/manifests/params.pp
 create mode 100644 puppet/modules/thumbslug/manifests/service.pp
 create mode 100644 puppet/modules/thumbslug/templates/etc/thumbslug/thumbslug.conf.erb

diff --git a/puppet/modules/candlepin/manifests/params.pp b/puppet/modules/candlepin/manifests/params.pp
index 5249005..225c1da 100644
--- a/puppet/modules/candlepin/manifests/params.pp
+++ b/puppet/modules/candlepin/manifests/params.pp
@@ -6,6 +6,9 @@ class candlepin::params {
   $cpsetup_log = "/var/log/katello/katello-configure/cpsetup.log"
 
   require "katello::params"
-  $oauth_key = $katello::params::oauth_key
-  $oauth_secret = $katello::params::oauth_secret
+  $katello_oauth_key = $katello::params::oauth_key
+  $katello_oauth_secret = $katello::params::oauth_secret
+
+  require "thumbslug::params"
+  $thumbslug_oauth_secret = $thumbslug::params::oauth_secret
 }
diff --git a/puppet/modules/candlepin/templates/etc/candlepin/candlepin.conf.erb b/puppet/modules/candlepin/templates/etc/candlepin/candlepin.conf.erb
index 55296d1..2ebd63d 100644
--- a/puppet/modules/candlepin/templates/etc/candlepin/candlepin.conf.erb
+++ b/puppet/modules/candlepin/templates/etc/candlepin/candlepin.conf.erb
@@ -4,8 +4,12 @@ jpa.config.hibernate.connection.url=jdbc:postgresql:<%= scope.lookupvar("candlep
 jpa.config.hibernate.hbm2ddl.auto=validate
 jpa.config.hibernate.connection.username=<%= scope.lookupvar("candlepin::params::db_user") %>
 jpa.config.hibernate.connection.password=<%= scope.lookupvar("candlepin::params::db_pass") %>
-<% unless scope.lookupvar("candlepin::params::oauth_key").empty? -%>
+<% unless scope.lookupvar("candlepin::params::katello_oauth_key").empty? -%>
 module.config.katello=org.fedoraproject.candlepin.katello.KatelloModule
 candlepin.auth.oauth.enabled = true
-candlepin.auth.oauth.consumer.<%= scope.lookupvar("candlepin::params::oauth_key") %>.secret = <%= scope.lookupvar("candlepin::params::oauth_secret") %>
+candlepin.auth.oauth.consumer.<%= scope.lookupvar("candlepin::params::katello_oauth_key") %>.secret = <%= scope.lookupvar("candlepin::params::katello_oauth_secret") %>
+<%- end -%>
+
+<% unless scope.lookupvar("candlepin::params::thumbslug_oauth_key").empty? -%>
+candlepin.auth.oauth.consumer.thumbslug.secret = <%= scope.lookupvar("candlepin::params::thumbslug_oauth_secret") %>
 <%- end -%>
diff --git a/puppet/modules/katello/manifests/config.pp b/puppet/modules/katello/manifests/config.pp
index 7295214..6d952a2 100644
--- a/puppet/modules/katello/manifests/config.pp
+++ b/puppet/modules/katello/manifests/config.pp
@@ -47,7 +47,7 @@ class katello::config {
     before => Exec["katello_seed_db"],
     require   => $katello::params::deployment ? {
         'katello' => [ Config_file["${katello::params::config_dir}/katello.yml"], Class["candlepin::service"], Class["pulp::service"] ],
-        'headpin' => [ Config_file["${katello::params::config_dir}/katello.yml"], Class["candlepin::service"] ],
+        'headpin' => [ Config_file["${katello::params::config_dir}/katello.yml"], Class["candlepin::service"], Class["thumbslug::service"] ],
          default  => [],
     },
   }
@@ -59,7 +59,7 @@ class katello::config {
       before => Exec["katello_seed_db"],
       require => $katello::params::deployment ? {
                 'katello' => [ Class["candlepin::service"], Class["pulp::service"]  ],
-                'headpin' => [ Class["candlepin::service"] ],
+                'headpin' => [ Class["candlepin::service"], Class["thumbslug::service"] ],
                 default => [],
     },
   }
@@ -71,7 +71,7 @@ class katello::config {
       before => Exec["katello_seed_db"],
       require => $katello::params::deployment ? {
                 'katello' => [ Class["candlepin::service"], Class["pulp::service"]  ],
-                'headpin' => [ Class["candlepin::service"] ],
+                'headpin' => [ Class["candlepin::service"], Class["thumbslug::service"] ],
                 default => [],
     },
   }
@@ -83,7 +83,7 @@ class katello::config {
       before => Exec["katello_seed_db"],
       require => $katello::params::deployment ? {
                 'katello' => [ Class["candlepin::service"], Class["pulp::service"]  ],
-                'headpin' => [ Class["candlepin::service"] ],
+                'headpin' => [ Class["candlepin::service"], Class["thumbslug::service"] ],
                 default => [],
     },
   }
@@ -95,7 +95,7 @@ class katello::config {
       before => Exec["katello_seed_db"],
       require => $katello::params::deployment ? {
                 'katello' => [ Class["candlepin::service"], Class["pulp::service"]  ],
-                'headpin' => [ Class["candlepin::service"] ],
+                'headpin' => [ Class["candlepin::service"], Class["thumbslug::service"] ],
                 default => [],
     },
   }
@@ -107,7 +107,7 @@ class katello::config {
       before => Exec["katello_seed_db"],
       require => $katello::params::deployment ? {
                 'katello' => [ Class["candlepin::service"], Class["pulp::service"]  ],
-                'headpin' => [ Class["candlepin::service"] ],
+                'headpin' => [ Class["candlepin::service"], Class["thumbslug::service"] ],
                 default => [],
     },
   }
@@ -133,7 +133,7 @@ class katello::config {
     before  => Class["katello::service"],
     require => $katello::params::deployment ? {
                 'katello' => [ Exec["katello_db_migrate"], Class["candlepin::service"], Class["pulp::service"] ],
-                'headpin' => [ Exec["katello_db_migrate"], Class["candlepin::service"] ],
+                'headpin' => [ Exec["katello_db_migrate"], Class["candlepin::service"], Class["thumbslug::service"] ],
                 default => [],
     },
   }
diff --git a/puppet/modules/katello/manifests/init.pp b/puppet/modules/katello/manifests/init.pp
index 14f0d93..ed3d5ca 100644
--- a/puppet/modules/katello/manifests/init.pp
+++ b/puppet/modules/katello/manifests/init.pp
@@ -7,6 +7,7 @@ class katello {
       }
       'headpin' : {
         include apache2
+        include thumbslug
       }
       default : {}
   }
diff --git a/puppet/modules/katello/manifests/install.pp b/puppet/modules/katello/manifests/install.pp
index 980edcf..1d18c27 100644
--- a/puppet/modules/katello/manifests/install.pp
+++ b/puppet/modules/katello/manifests/install.pp
@@ -36,12 +36,12 @@ class katello::install {
 	package{["katello", "katello-cli"]:
     require => $katello::params::deployment ? {
                 'katello' => [Yumrepo["fedora-katello"],Class["pulp::install"],Class["candlepin::install"]],
-                'headpin' => [Yumrepo["fedora-katello"],Class["candlepin::install"]],
+                'headpin' => [Yumrepo["fedora-katello"],Class["candlepin::install"],Class["thumbslug::install"]],
                 default => []
     },
     before  => $katello::params::deployment ? {
                 'katello' =>  [Class["candlepin::config"], Class["pulp::config"] ], #avoid some funny post rpm scripts
-                'headpin' =>  [Class["candlepin::config"]], #avoid some funny post rpm scripts
+                'headpin' =>  [Class["candlepin::config"], Class["thumbslug::config"]], #avoid some funny post rpm scripts
                 default => []
     },
     ensure  => installed
diff --git a/puppet/modules/katello/manifests/service.pp b/puppet/modules/katello/manifests/service.pp
index 46a29ec..12ebd9e 100644
--- a/puppet/modules/katello/manifests/service.pp
+++ b/puppet/modules/katello/manifests/service.pp
@@ -3,7 +3,7 @@ class katello::service {
     ensure  => running, enable => true, hasstatus => true, hasrestart => true,
     require => $katello::params::deployment ? {
                 'katello' =>  [Class["katello::config"],Class["candlepin::service"], Class["pulp::service"], Class["apache2::config"]],
-                'headpin' =>  [Class["katello::config"],Class["candlepin::service"], Class["apache2::config"]],
+                'headpin' =>  [Class["katello::config"],Class["candlepin::service"], Class["thumbslug::service"], Class["apache2::config"]],
                 default => []
     },
     notify  => Exec["reload-apache2"];
diff --git a/puppet/modules/thumbslug/manifests/config.pp b/puppet/modules/thumbslug/manifests/config.pp
new file mode 100644
index 0000000..c56a991
--- /dev/null
+++ b/puppet/modules/thumbslug/manifests/config.pp
@@ -0,0 +1,6 @@
+class thumbslug::config {
+  file { "/etc/thumbslug/thumbslug.conf":
+    content => template("thumbslug/etc/thumbslug/thumbslug.conf.erb"),
+    notify  => Service["thumbslug"];
+  }
+}
diff --git a/puppet/modules/thumbslug/manifests/init.pp b/puppet/modules/thumbslug/manifests/init.pp
new file mode 100644
index 0000000..10255cf
--- /dev/null
+++ b/puppet/modules/thumbslug/manifests/init.pp
@@ -0,0 +1,5 @@
+class thumbslug {
+  include thumbslug::params
+  include thumbslug::config
+  include thumbslug::service
+}
diff --git a/puppet/modules/thumbslug/manifests/install.pp b/puppet/modules/thumbslug/manifests/install.pp
new file mode 100644
index 0000000..19f62d7
--- /dev/null
+++ b/puppet/modules/thumbslug/manifests/install.pp
@@ -0,0 +1,17 @@
+class thumbslug::install {
+  $os_type = $operatingsystem ? {
+    "Fedora" => "fedora",
+    default  => "epel"
+  }
+  yumrepo { "thumbslug":
+    descr    => 'Thumbslug Repo',
+    baseurl  => "http://repos.fedorapeople.org/repos/candlepin/thumbslug/$os_type-\$releasever/\$basearch",
+    enabled  => "1",
+    gpgcheck => "0"
+  }
+
+	package{"thumbslug":
+    require => Yumrepo["thumbslug"],
+    ensure  => installed
+  }
+}
diff --git a/puppet/modules/thumbslug/manifests/params.pp b/puppet/modules/thumbslug/manifests/params.pp
new file mode 100644
index 0000000..0fcf508
--- /dev/null
+++ b/puppet/modules/thumbslug/manifests/params.pp
@@ -0,0 +1,5 @@
+class thumbslug::params {
+  $keystore = "/etc/candlepin/certs/keystore"
+  $keystore_pass = "secret"
+  $oauth_secret = regsubst(generate('/usr/bin/openssl', 'rand', '-base64', '24'), '^(.{24}).*', '\1')
+}
diff --git a/puppet/modules/thumbslug/manifests/service.pp b/puppet/modules/thumbslug/manifests/service.pp
new file mode 100644
index 0000000..2dfad6d
--- /dev/null
+++ b/puppet/modules/thumbslug/manifests/service.pp
@@ -0,0 +1,6 @@
+class thumbslug::service {
+  service {"thumbslug":
+    ensure  => running, enable => true, hasstatus => true, hasrestart => true,
+    require => Class["thumbslug::config"]
+  }
+}
diff --git a/puppet/modules/thumbslug/templates/etc/thumbslug/thumbslug.conf.erb b/puppet/modules/thumbslug/templates/etc/thumbslug/thumbslug.conf.erb
new file mode 100644
index 0000000..579934f
--- /dev/null
+++ b/puppet/modules/thumbslug/templates/etc/thumbslug/thumbslug.conf.erb
@@ -0,0 +1,3 @@
+ssl.keystore = <%= scope.lookupvar("thumbslug::params::keystore") %>
+ssl.keystore.password = <%= scope.lookupvar("thumbslug::params::keystore_pass") %>
+candlepin.oauth.secret = <%= scope.lookupvar("thumbslug::params::oauth_secret") %>
-- 
1.7.4.4




More information about the katello-devel mailing list