| OLD | NEW | 
|---|
| 1 class base ($zone='adblockplus.org') { | 1 class base ($zone='adblockplus.org') { | 
| 2   stage {'pre': before => Stage['main']} | 2   stage {'pre': before => Stage['main']} | 
| 3   stage {'post': require => Stage['main']} | 3   stage {'post': require => Stage['main']} | 
| 4 | 4 | 
| 5   class {'users': | 5   class {'users': | 
| 6     stage => 'pre', | 6     stage => 'pre', | 
| 7   } | 7   } | 
| 8 | 8 | 
| 9   if !defined(Class['apt']) { | 9   if !defined(Class['apt']) { | 
| 10     class {'apt': | 10     class {'apt': | 
| (...skipping 23 matching lines...) Expand all  Loading... | 
| 34   create_resources(base::explicit_host_record, $servers) | 34   create_resources(base::explicit_host_record, $servers) | 
| 35 | 35 | 
| 36   define explicit_host_record( | 36   define explicit_host_record( | 
| 37     $ip, | 37     $ip, | 
| 38     $ssh_public_key = undef, | 38     $ssh_public_key = undef, | 
| 39     $role           = undef, | 39     $role           = undef, | 
| 40     $dns            = undef, | 40     $dns            = undef, | 
| 41     $groups         = undef, | 41     $groups         = undef, | 
| 42   ) { | 42   ) { | 
| 43 | 43 | 
| 44     if is_array($ip) { | 44     $fqdn = $dns ? { | 
| 45       $internal_ip = $ip[0] | 45       undef => "$name.${base::zone}", | 
| 46     } else { | 46       default => $dns, | 
| 47       $internal_ip = $ip |  | 
| 48     } | 47     } | 
| 49 | 48 | 
| 50     $fqdn_name = join([$name, $base::zone], '.') | 49     $ips = is_array($ip) ? { | 
| 51 | 50       true => $ip, | 
| 52     host{$name: | 51       default => [$ip], | 
| 53       ensure => present, |  | 
| 54       ip => $internal_ip, |  | 
| 55       name => $fqdn_name, |  | 
| 56       host_aliases => $dns ? { |  | 
| 57         undef => [], |  | 
| 58         default => $dns, |  | 
| 59       } |  | 
| 60     } | 52     } | 
| 61 | 53 | 
| 62     if $ssh_public_key != undef { | 54     $public_key = $ssh_public_key ? { | 
|  | 55       undef => undef, | 
|  | 56       default => "ssh-rsa $ssh_public_key $fqdn", | 
|  | 57     } | 
| 63 | 58 | 
| 64       $name_key = $dns ? { | 59     adblockplus::host {$title: | 
| 65         undef => $fqdn_name, | 60       fqdn => $fqdn, | 
| 66         default => $dns, | 61       groups => $groups, | 
| 67       } | 62       ips => $ips, | 
|  | 63       name => $name, | 
|  | 64       role => $role, | 
|  | 65       public_key => $public_key, | 
|  | 66     } | 
| 68 | 67 | 
| 69       @sshkey {$name: | 68     # Implicit realization behavior has been introduced by accident in a | 
| 70         name => $name_key, | 69     # previous version, hence it should be kept until class base is obsolete | 
| 71         key => $ssh_public_key, | 70     # and the obsolete records have been removed | 
| 72         type => ssh-rsa, | 71     realize(Host[$title]) | 
| 73         host_aliases => $ip, | 72     realize(Sshkey[$title]) | 
| 74         tag => 'base::explicit_host_record', |  | 
| 75       } |  | 
| 76     } |  | 
| 77   } |  | 
| 78 |  | 
| 79   # Work around https://projects.puppetlabs.com/issues/4145 |  | 
| 80   Sshkey<| |> -> |  | 
| 81   file {'/etc/ssh/ssh_known_hosts': |  | 
| 82     ensure => 'present', |  | 
| 83     mode => 0644, |  | 
| 84   } | 73   } | 
| 85 } | 74 } | 
| OLD | NEW | 
|---|