From 1e4e6a09af23891a93e02f4b168a9463e9b9178f Mon Sep 17 00:00:00 2001 From: Alex Vandiver Date: Wed, 29 Dec 2021 20:44:03 +0000 Subject: [PATCH] puppet: Stop making resources for external binaries and directories. In the event that extracting doesn't produce the binary we expected it to, all this will do is create an _empty_ file where we expect the binary to be. This will likely muddle debugging. Since the only reason the resourfce was made in the first place was to make dependencies clear, switch to depending on the External_Dep itself, when such a dependency is needed. --- puppet/zulip/manifests/camo.pp | 3 +-- puppet/zulip/manifests/external_dep.pp | 15 +-------------- puppet/zulip/manifests/golang.pp | 1 - puppet/zulip/manifests/smokescreen.pp | 13 ++++++------- puppet/zulip_ops/manifests/profile/grafana.pp | 3 +-- .../manifests/profile/prometheus_server.pp | 5 ++--- puppet/zulip_ops/manifests/prometheus/node.pp | 3 +-- 7 files changed, 12 insertions(+), 31 deletions(-) diff --git a/puppet/zulip/manifests/camo.pp b/puppet/zulip/manifests/camo.pp index 303a5effcb..4a67dfd59e 100644 --- a/puppet/zulip/manifests/camo.pp +++ b/puppet/zulip/manifests/camo.pp @@ -15,7 +15,6 @@ class zulip::camo (String $listen_address = '0.0.0.0') { url => "https://github.com/cactus/go-camo/releases/download/v${version}/go-camo-${version}.go1171.linux-${::architecture}.tar.gz", sha256 => '965506e6edb9d974c810519d71e847afb7ca69d1d01ae7d8be6d7a91de669c0c', tarball_prefix => "go-camo-${version}", - bin => 'bin/go-camo', } file { "${zulip::common::supervisor_conf_dir}/go-camo.conf": @@ -23,7 +22,7 @@ class zulip::camo (String $listen_address = '0.0.0.0') { require => [ Package['camo'], Package[supervisor], - File[$bin], + Zulip::External_Dep['go-camo'], File['/usr/local/bin/secret-env-wrapper'], ], owner => 'root', diff --git a/puppet/zulip/manifests/external_dep.pp b/puppet/zulip/manifests/external_dep.pp index 20f5c614d0..fda591f0b0 100644 --- a/puppet/zulip/manifests/external_dep.pp +++ b/puppet/zulip/manifests/external_dep.pp @@ -3,7 +3,6 @@ define zulip::external_dep( String $sha256, String $url, String $tarball_prefix, - String $bin = '', ) { $dir = "/srv/zulip-${title}-${version}" @@ -16,18 +15,6 @@ define zulip::external_dep( }, } - file { $dir: - ensure => directory, - require => Zulip::Sha256_tarball_to[$title], - } - - if $bin != '' { - file { "${dir}/${bin}": - ensure => file, - require => File[$dir], - } - } - unless $::operatingsystem == 'Ubuntu' and $::operatingsystemrelease == '18.04' { # Puppet 5.5.0 and below make this always-noisy, as they spout out # a notify line about tidying the managed directory above. Skip @@ -38,7 +25,7 @@ define zulip::external_dep( recurse => 1, rmdirs => true, matches => "zulip-${title}-*", - require => File[$dir], + require => Zulip::Sha256_Tarball_To[$title], } } } diff --git a/puppet/zulip/manifests/golang.pp b/puppet/zulip/manifests/golang.pp index f550e93b23..1e25fefa5e 100644 --- a/puppet/zulip/manifests/golang.pp +++ b/puppet/zulip/manifests/golang.pp @@ -11,6 +11,5 @@ class zulip::golang { url => "https://golang.org/dl/go${version}.linux-${::architecture}.tar.gz", sha256 => '550f9845451c0c94be679faf116291e7807a8d78b43149f9506c1b15eb89008c', tarball_prefix => 'go', - bin => 'bin/go', } } diff --git a/puppet/zulip/manifests/smokescreen.pp b/puppet/zulip/manifests/smokescreen.pp index be0606ae72..bf63ebaa08 100644 --- a/puppet/zulip/manifests/smokescreen.pp +++ b/puppet/zulip/manifests/smokescreen.pp @@ -19,11 +19,10 @@ class zulip::smokescreen { # GOCACHE is required; nothing is written to GOPATH, but it is required to be set environment => ['GOCACHE=/tmp/gocache', 'GOPATH=/root/go'], creates => $bin, - require => [File[$zulip::golang::bin], File[$dir]], - } - file { $bin: - ensure => file, - require => Exec['compile smokescreen'], + require => [ + Zulip::External_Dep['golang'], + Zulip::External_Dep['smokescreen-src'], + ], } unless $::operatingsystem == 'Ubuntu' and $::operatingsystemrelease == '18.04' { # Puppet 5.5.0 and below make this always-noisy, as they spout out @@ -34,7 +33,7 @@ class zulip::smokescreen { path => '/usr/local/bin', recurse => 1, matches => 'smokescreen-*', - require => File[$bin], + require => Exec['compile smokescreen'], } } @@ -43,7 +42,7 @@ class zulip::smokescreen { ensure => file, require => [ Package[supervisor], - File[$bin], + Exec['compile smokescreen'], ], owner => 'root', group => 'root', diff --git a/puppet/zulip_ops/manifests/profile/grafana.pp b/puppet/zulip_ops/manifests/profile/grafana.pp index e8a3b25f65..8b45bf6bf3 100644 --- a/puppet/zulip_ops/manifests/profile/grafana.pp +++ b/puppet/zulip_ops/manifests/profile/grafana.pp @@ -13,7 +13,6 @@ class zulip_ops::profile::grafana { url => "https://dl.grafana.com/oss/release/grafana-${version}.linux-${::architecture}.tar.gz", sha256 => '100f92c50aa612f213052c55594e58b68b7da641b751c5f144003d704730d189', tarball_prefix => "grafana-${version}", - bin => 'bin/grafana-server', } group { 'grafana': @@ -46,7 +45,7 @@ class zulip_ops::profile::grafana { ensure => file, require => [ Package[supervisor], - File[$bin], + Zulip::External_Dep['grafana'], File['/var/lib/grafana'], File['/var/log/grafana'], ], diff --git a/puppet/zulip_ops/manifests/profile/prometheus_server.pp b/puppet/zulip_ops/manifests/profile/prometheus_server.pp index 1bb9fb5d97..3b83ca3735 100644 --- a/puppet/zulip_ops/manifests/profile/prometheus_server.pp +++ b/puppet/zulip_ops/manifests/profile/prometheus_server.pp @@ -16,12 +16,11 @@ class zulip_ops::profile::prometheus_server { url => "https://github.com/prometheus/prometheus/releases/download/v${version}/prometheus-${version}.linux-${::architecture}.tar.gz", sha256 => 'ce637d0167d5e6d2561f3bd37e1c58fe8601e13e4e1ea745653c068f6e1317ae', tarball_prefix => "prometheus-${version}.linux-${::architecture}", - bin => 'prometheus', } file { '/usr/local/bin/promtool': ensure => 'link', target => "${dir}/promtool", - require => File[$dir], + require => Zulip::External_Dep['prometheus'], } # This was moved to an external dep in 2021/12, and the below can be # removed once the prod server has taken the update. @@ -54,7 +53,7 @@ class zulip_ops::profile::prometheus_server { ensure => file, require => [ Package[supervisor], - File[$bin], + Zulip::External_Dep['prometheus'], File[$data_dir], File['/etc/prometheus/prometheus.yaml'], ], diff --git a/puppet/zulip_ops/manifests/prometheus/node.pp b/puppet/zulip_ops/manifests/prometheus/node.pp index 8c1f4151b9..caa610a833 100644 --- a/puppet/zulip_ops/manifests/prometheus/node.pp +++ b/puppet/zulip_ops/manifests/prometheus/node.pp @@ -13,7 +13,6 @@ class zulip_ops::prometheus::node { url => "https://github.com/prometheus/node_exporter/releases/download/v${version}/node_exporter-${version}.linux-${::architecture}.tar.gz", sha256 => '8c1f6a317457a658e0ae68ad710f6b4098db2cad10204649b51e3c043aa3e70d', tarball_prefix => "node_exporter-${version}.linux-${::architecture}", - bin => 'node_exporter', } # This was moved to an external_dep in 2021/12, and these lines can @@ -28,7 +27,7 @@ class zulip_ops::prometheus::node { require => [ User[zulip], Package[supervisor], - File[$bin], + Zulip::External_Dep['node_exporter'], ], owner => 'root', group => 'root',