Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

puppet: Extract an external-tarball-dependency manifest.

Alex Vandiverbb9d2df1ae74
diff --git a/puppet/zulip/manifests/external_dep.pp b/puppet/zulip/manifests/external_dep.pp
new file mode 100644
index 00000000000..131eb8cb958
--- /dev/null
+++ b/puppet/zulip/manifests/external_dep.pp
@@ -0,0 +1,44 @@
+define zulip::external_dep(
+ String $version,
+ String $sha256,
+ String $url,
+ String $tarball_prefix,
+ String $bin = '',
+) {
+
+ $dir = "/srv/zulip-${title}-${version}/"
+
+ zulip::sha256_tarball_to { $title:
+ url => $url,
+ sha256 => $sha256,
+ install => {
+ $tarball_prefix => $dir,
+ },
+ }
+
+ 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
+ # on Bionic, which has that old version; they'll get tidied upon
+ # upgrade to 20.04.
+ tidy { "/srv/zulip-${title}-*":
+ path => '/srv/',
+ recurse => 1,
+ rmdirs => true,
+ matches => "zulip-${title}-*",
+ require => File[$dir],
+ }
+ }
+}
diff --git a/puppet/zulip/manifests/golang.pp b/puppet/zulip/manifests/golang.pp
index 5de698a781f..afc6625a6e5 100644
--- a/puppet/zulip/manifests/golang.pp
+++ b/puppet/zulip/manifests/golang.pp
@@ -6,35 +6,11 @@ class zulip::golang {
$dir = "/srv/zulip-golang-${version}/"
$bin = "${dir}bin/go"
- zulip::sha256_tarball_to { 'golang':
- url => "https://golang.org/dl/go${version}.linux-amd64.tar.gz",
- sha256 => '550f9845451c0c94be679faf116291e7807a8d78b43149f9506c1b15eb89008c',
- install => {
- 'go/' => $dir,
- },
- }
-
- file { $bin:
- ensure => file,
- require => Zulip::Sha256_tarball_to['golang'],
- }
-
- file { $dir:
- ensure => directory,
- require => Zulip::Sha256_tarball_to['golang'],
- }
-
- 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
- # on Bionic, which has that old version; they'll get tidied upon
- # upgrade to 20.04.
- tidy { '/srv/zulip-golang-*':
- path => '/srv/',
- recurse => 1,
- rmdirs => true,
- matches => 'zulip-golang-*',
- require => File[$dir],
- }
+ zulip::external_dep { 'golang':
+ version => $version,
+ url => "https://golang.org/dl/go${version}.linux-amd64.tar.gz",
+ sha256 => '550f9845451c0c94be679faf116291e7807a8d78b43149f9506c1b15eb89008c',
+ tarball_prefix => 'go/',
+ bin => 'bin/go',
}
}