commit eb7a2c55d49c78a3f779dfd34bc29107d5045d59
Author: Ivan Nečas <inecas@redhat.com>
Date:   Tue Apr 29 14:07:15 2014 +0200

    Refs #5423 - fix capsule configuration

diff --git a/manifests/certs.pp b/manifests/certs.pp
deleted file mode 100644
index 2dc71f5..0000000
--- a/manifests/certs.pp
+++ /dev/null
@@ -1,8 +0,0 @@
-# Handles certs for Capsules
-class capsule::certs {
-
-  certs::tar_extract { $capsule::certs_tar:
-    before => Class['certs']
-  }
-
-}
diff --git a/manifests/init.pp b/manifests/init.pp
index 123ced1..9a8616f 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -10,7 +10,6 @@
 #                                   type:boolean
 #
 # $pulp_admin_password::            passowrd for the Pulp admin user.It should be left blank so that random password is generated
-#                                   type:password
 #
 # $pulp_oauth_effective_user::      User to be used for Pulp REST interaction
 #
@@ -107,36 +106,39 @@ class capsule (
     validate_present($pulp_oauth_secret)
   }
 
+  $capsule_fqdn = $::fqdn
   $foreman_url = "https://${parent_fqdn}"
 
   if $register_in_foreman {
     validate_present($foreman_oauth_secret)
   }
 
-  if $certs_tar {
-    class { 'capsule::certs': }
-  }
-
   if $pulp {
-    class { 'certs::apache': }
+    class { 'certs::apache':     hostname => $capsule_fqdn }
     class { 'pulp':
       default_password => $pulp_admin_password,
       oauth_key        => $pulp_oauth_key,
       oauth_secret     => $pulp_oauth_secret
-    }
+    } ~>
     class { 'pulp::child':
       parent_fqdn          => $parent_fqdn,
       oauth_effective_user => $pulp_oauth_effective_user,
       oauth_key            => $pulp_oauth_key,
       oauth_secret         => $pulp_oauth_secret
     }
+
+    class { 'certs::pulp_child':
+      hostname => $capsule_fqdn,
+      notify   => [ Class['pulp'], Class['pulp::child'] ],
+    }
+
     katello_node { "https://${parent_fqdn}/katello":
       content => $pulp
     }
   }
 
   if $puppet {
-    class { 'certs::puppet': } ~>
+    class { 'certs::puppet': hostname => $capsule_fqdn } ~>
 
     class { 'puppet':
       server                      => true,
@@ -155,6 +157,7 @@ class capsule (
   if $tftp or $dhcp or $dns or $puppet or $puppetca {
 
     class { 'certs::foreman_proxy':
+      hostname   => $capsule_fqdn,
       require    => Package['foreman-proxy'],
       before     => Service['foreman-proxy'],
     }
@@ -180,10 +183,30 @@ class capsule (
       dns_forwarders        => $dns_forwarders,
       register_in_foreman   => $register_in_foreman,
       foreman_base_url      => $foreman_url,
-      registered_proxy_url  => "https://${::fqdn}:${capsule::foreman_proxy_port}",
+      registered_proxy_url  => "https://${capsule_fqdn}:${capsule::foreman_proxy_port}",
       oauth_effective_user  => $foreman_oauth_effective_user,
       oauth_consumer_key    => $foreman_oauth_key,
       oauth_consumer_secret => $foreman_oauth_secret
     }
   }
+
+  if $certs_tar {
+    certs::tar_extract { $capsule::certs_tar: }
+
+    if defined(Class['certs::apache']) {
+      Certs::Tar_extract[$certs_tar] -> Class['certs::apache']
+    }
+
+    if defined(Class['certs::foreman_proxy']) {
+      Certs::Tar_extract[$certs_tar] -> Class['certs::foreman_proxy']
+    }
+
+    if defined(Class['certs::pulp_child']) {
+      Certs::Tar_extract[$certs_tar] -> Class['certs::pulp_child']
+    }
+
+    if defined(Class['certs::puppet']) {
+      Certs::Tar_extract[$certs_tar] -> Class['certs::puppet']
+    }
+  }
 }
diff --git a/manifests/params.pp b/manifests/params.pp
index ad37722..ab38973 100644
--- a/manifests/params.pp
+++ b/manifests/params.pp
@@ -12,7 +12,7 @@ class capsule::params {
   $foreman_oauth_secret       = cache_data('oauth_consumer_secret', random_password(32))
 
   $pulp                       = false
-  $pulp_admin_password        = undef
+  $pulp_admin_password        = cache_data('pulp_node_admin_password', random_password(32))
   $pulp_oauth_effective_user  = 'admin'
   $pulp_oauth_key             = 'katello'
   $pulp_oauth_secret          = undef
