From b3e6d49d2f9d2676ba5415f09353a0fcc5f597a3 Mon Sep 17 00:00:00 2001 From: Zev Benjamin Date: Fri, 1 Nov 2013 15:28:03 -0400 Subject: [PATCH] puppet: Switch puppet to using include-style class declarations This allows us to declare classes more than once, which we need as we're making our class dependency graph more complicated. See http://docs.puppetlabs.com/puppet/2.7/reference/lang_classes.html#aside-history-the-future-and-best-practices (imported from commit d4199b0df0d92d166fbc3559957f67ee9cf2ecdc) --- puppet/zulip-internal/manifests/base.pp | 2 +- puppet/zulip-internal/manifests/bots.pp | 4 ++-- puppet/zulip-internal/manifests/builder.pp | 2 +- puppet/zulip-internal/manifests/git.pp | 2 +- puppet/zulip-internal/manifests/loadbalancer.pp | 4 ++-- puppet/zulip-internal/manifests/mediawiki.pp | 2 +- puppet/zulip-internal/manifests/nagios.pp | 4 ++-- puppet/zulip-internal/manifests/postgres-appdb.pp | 4 ++-- puppet/zulip-internal/manifests/postgres-master.pp | 4 ++-- puppet/zulip-internal/manifests/postgres-slave.pp | 4 ++-- puppet/zulip-internal/manifests/prod_app_frontend.pp | 4 ++-- puppet/zulip-internal/manifests/staging_app_frontend.pp | 4 ++-- puppet/zulip-internal/manifests/stats.pp | 6 +++--- puppet/zulip-internal/manifests/trac.pp | 6 +++--- puppet/zulip-internal/manifests/zmirror.pp | 4 ++-- puppet/zulip-internal/manifests/zmirror_personals.pp | 4 ++-- puppet/zulip/manifests/app_frontend.pp | 6 +++--- puppet/zulip/manifests/local_server.pp | 4 ++-- scripts/zulip-puppet-apply | 4 ++-- 19 files changed, 37 insertions(+), 37 deletions(-) diff --git a/puppet/zulip-internal/manifests/base.pp b/puppet/zulip-internal/manifests/base.pp index 3b07310a9b..41f4962360 100644 --- a/puppet/zulip-internal/manifests/base.pp +++ b/puppet/zulip-internal/manifests/base.pp @@ -1,5 +1,5 @@ class zulip-internal::base { - class { 'zulip::base': } + include zulip::base $org_base_packages = [ "nagios-plugins-basic", "munin-node", "munin-plugins-extra" ] package { $org_base_packages: ensure => "installed" } diff --git a/puppet/zulip-internal/manifests/bots.pp b/puppet/zulip-internal/manifests/bots.pp index 259dcb66ca..71eb3790a8 100644 --- a/puppet/zulip-internal/manifests/bots.pp +++ b/puppet/zulip-internal/manifests/bots.pp @@ -1,6 +1,6 @@ class zulip-internal::bots { - class { 'zulip-internal::base': } - class { 'zulip::supervisor': } + include zulip-internal::base + include zulip::supervisor file { '/etc/supervisor/conf.d/feedback-bot.conf': ensure => absent, diff --git a/puppet/zulip-internal/manifests/builder.pp b/puppet/zulip-internal/manifests/builder.pp index 56209634a6..01e951ea30 100644 --- a/puppet/zulip-internal/manifests/builder.pp +++ b/puppet/zulip-internal/manifests/builder.pp @@ -1,5 +1,5 @@ class zulip-internal::builder { - class { 'zulip-internal::base': } + include zulip-internal::base $buildd_packages = [ "apt-spy", diff --git a/puppet/zulip-internal/manifests/git.pp b/puppet/zulip-internal/manifests/git.pp index 81e4419873..ef1b024882 100644 --- a/puppet/zulip-internal/manifests/git.pp +++ b/puppet/zulip-internal/manifests/git.pp @@ -1,5 +1,5 @@ class zulip-internal::git { - class { 'zulip-internal::base': } + include zulip-internal::base $git_packages = [ ] package { $git_packages: ensure => "installed" } diff --git a/puppet/zulip-internal/manifests/loadbalancer.pp b/puppet/zulip-internal/manifests/loadbalancer.pp index fdc989a1e6..97a137dadd 100644 --- a/puppet/zulip-internal/manifests/loadbalancer.pp +++ b/puppet/zulip-internal/manifests/loadbalancer.pp @@ -1,6 +1,6 @@ class zulip-internal::loadbalancer { - class { 'zulip-internal::base': } - class { 'zulip::nginx': } + include zulip-internal::base + include zulip::nginx file { "/etc/nginx/zulip-include/": require => Package[nginx], diff --git a/puppet/zulip-internal/manifests/mediawiki.pp b/puppet/zulip-internal/manifests/mediawiki.pp index b51c9b9430..ff703f097c 100644 --- a/puppet/zulip-internal/manifests/mediawiki.pp +++ b/puppet/zulip-internal/manifests/mediawiki.pp @@ -1,5 +1,5 @@ class zulip-internal::mediawiki { - class { 'zulip-internal::postgres-common': } + include zulip-internal::postgres-common $mediawiki_packages = [ "mediawiki", "mediawiki-extensions" ] diff --git a/puppet/zulip-internal/manifests/nagios.pp b/puppet/zulip-internal/manifests/nagios.pp index c8e7c91e7c..7edadbff35 100644 --- a/puppet/zulip-internal/manifests/nagios.pp +++ b/puppet/zulip-internal/manifests/nagios.pp @@ -1,6 +1,6 @@ class zulip-internal::nagios { - class { 'zulip-internal::base': } - class { 'zulip-internal::apache': } + include zulip-internal::base + include zulip-internal::apache $nagios_packages = [ "nagios3", "munin", "autossh" ] package { $nagios_packages: ensure => "installed" } diff --git a/puppet/zulip-internal/manifests/postgres-appdb.pp b/puppet/zulip-internal/manifests/postgres-appdb.pp index cc8b744588..1ebd26e8b8 100644 --- a/puppet/zulip-internal/manifests/postgres-appdb.pp +++ b/puppet/zulip-internal/manifests/postgres-appdb.pp @@ -1,6 +1,6 @@ class zulip-internal::postgres-appdb { - class { 'zulip-internal::postgres-common': } - class { 'zulip::supervisor': } + include zulip-internal::postgres-common + include zulip::supervisor $appdb_packages = [ "python-psycopg2",] package { $appdb_packages: ensure => "installed" } diff --git a/puppet/zulip-internal/manifests/postgres-master.pp b/puppet/zulip-internal/manifests/postgres-master.pp index 62c35ddafa..44a8d68b4c 100644 --- a/puppet/zulip-internal/manifests/postgres-master.pp +++ b/puppet/zulip-internal/manifests/postgres-master.pp @@ -1,6 +1,6 @@ class zulip-internal::postgres-master { - class { 'zulip-internal::base': } - class { 'zulip-internal::postgres-appdb': } + include zulip-internal::base + include zulip-internal::postgres-appdb $master_packages = [ "xfsprogs", "mdadm", ] package { $master_packages: ensure => "installed" } diff --git a/puppet/zulip-internal/manifests/postgres-slave.pp b/puppet/zulip-internal/manifests/postgres-slave.pp index b713d8603a..d70d42e3bd 100644 --- a/puppet/zulip-internal/manifests/postgres-slave.pp +++ b/puppet/zulip-internal/manifests/postgres-slave.pp @@ -1,6 +1,6 @@ class zulip-internal::postgres-slave { - class { 'zulip-internal::base': } - class { 'zulip-internal::postgres-appdb': } + include zulip-internal::base + include zulip-internal::postgres-appdb # We bundle a bunch of other sysctl parameters into 40-postgresql.conf file { '/etc/sysctl.d/30-postgresql-shm.conf': diff --git a/puppet/zulip-internal/manifests/prod_app_frontend.pp b/puppet/zulip-internal/manifests/prod_app_frontend.pp index 47939b070e..c9a7ce5f05 100644 --- a/puppet/zulip-internal/manifests/prod_app_frontend.pp +++ b/puppet/zulip-internal/manifests/prod_app_frontend.pp @@ -1,6 +1,6 @@ class zulip-internal::prod_app_frontend { - class { 'zulip-internal::base': } - class { 'zulip::app_frontend': } + include zulip-internal::base + include zulip::app_frontend file { "/etc/nginx/sites-available/zulip": require => Package[nginx], diff --git a/puppet/zulip-internal/manifests/staging_app_frontend.pp b/puppet/zulip-internal/manifests/staging_app_frontend.pp index 513ca160f7..7a501181b4 100644 --- a/puppet/zulip-internal/manifests/staging_app_frontend.pp +++ b/puppet/zulip-internal/manifests/staging_app_frontend.pp @@ -1,6 +1,6 @@ class zulip-internal::staging_app_frontend { - class { 'zulip-internal::base': } - class { 'zulip::app_frontend': } + include zulip-internal::base + include zulip::app_frontend $packages = [ "python-html2text" ] package { $packages: ensure => "installed" } diff --git a/puppet/zulip-internal/manifests/stats.pp b/puppet/zulip-internal/manifests/stats.pp index f9a41a6bc5..45c4804d8d 100644 --- a/puppet/zulip-internal/manifests/stats.pp +++ b/puppet/zulip-internal/manifests/stats.pp @@ -1,7 +1,7 @@ class zulip-internal::stats { - class { 'zulip-internal::base': } - class { 'zulip-internal::apache': } - class { 'zulip::supervisor': } + include zulip-internal::base + include zulip-internal::apache + include zulip::supervisor $stats_packages = [ "libssl-dev", "zlib1g-dev", "python-twisted", "python-django", "python-django-tagging", "python-carbon", "python-cairo", "python-graphite-web", "python-whisper", "redis-server" ] diff --git a/puppet/zulip-internal/manifests/trac.pp b/puppet/zulip-internal/manifests/trac.pp index 7323d8685e..9a16d73309 100644 --- a/puppet/zulip-internal/manifests/trac.pp +++ b/puppet/zulip-internal/manifests/trac.pp @@ -1,7 +1,7 @@ class zulip-internal::trac { - class { 'zulip-internal::base': } - class { 'zulip-internal::apache': } - class { 'zulip-internal::mediawiki': } + include zulip-internal::base + include zulip-internal::apache + include zulip-internal::mediawiki $trac_packages = [ "trac", ] package { $trac_packages: ensure => "installed" } diff --git a/puppet/zulip-internal/manifests/zmirror.pp b/puppet/zulip-internal/manifests/zmirror.pp index ab10b16050..c6a3456dcf 100644 --- a/puppet/zulip-internal/manifests/zmirror.pp +++ b/puppet/zulip-internal/manifests/zmirror.pp @@ -1,6 +1,6 @@ class zulip-internal::zmirror { - class { 'zulip-internal::base': } - class { 'zulip::supervisor': } + include zulip-internal::base + include zulip::supervisor $zmirror_packages = [ "cython", "libzephyr-dev", "comerr-dev", "python-dev", "libzephyr4-krb5", "zephyr-clients", "krb5-config", "krb5-user", "krb5-clients", "debathena-kerberos-config", "debathena-zephyr-config"] diff --git a/puppet/zulip-internal/manifests/zmirror_personals.pp b/puppet/zulip-internal/manifests/zmirror_personals.pp index b8293a8d05..60581c7b68 100644 --- a/puppet/zulip-internal/manifests/zmirror_personals.pp +++ b/puppet/zulip-internal/manifests/zmirror_personals.pp @@ -1,6 +1,6 @@ class zulip-internal::zmirror_personals { - class { 'zulip-internal::base': } - class { 'zulip::supervisor': } + include zulip-internal::base + include zulip::supervisor $zmirror_packages = [ "cython", "libzephyr-dev", "comerr-dev", "python-dev", "libzephyr4-krb5", "zephyr-clients", "krb5-config", "krb5-user", "krb5-clients", "debathena-kerberos-config", "debathena-zephyr-config"] diff --git a/puppet/zulip/manifests/app_frontend.pp b/puppet/zulip/manifests/app_frontend.pp index 3ec3079d50..54b75fdec0 100644 --- a/puppet/zulip/manifests/app_frontend.pp +++ b/puppet/zulip/manifests/app_frontend.pp @@ -1,7 +1,7 @@ class zulip::app_frontend { - class { 'zulip::rabbit': } - class { 'zulip::nginx': } - class { 'zulip::supervisor': } + include zulip::rabbit + include zulip::nginx + include zulip::supervisor $web_packages = [ "memcached", "python-pylibmc", "python-tornado", "python-django", "python-pygments", "python-flup", "python-psycopg2", diff --git a/puppet/zulip/manifests/local_server.pp b/puppet/zulip/manifests/local_server.pp index 5e728e2d2b..bd7def228d 100644 --- a/puppet/zulip/manifests/local_server.pp +++ b/puppet/zulip/manifests/local_server.pp @@ -1,6 +1,6 @@ class zulip::local_server { - class { 'zulip::base': } - class { 'zulip::app_frontend': } + include zulip::base + include zulip::app_frontend package { "postgresql-9.1": ensure => installed } # This should be migrated over to app_frontend, once validated as functional diff --git a/scripts/zulip-puppet-apply b/scripts/zulip-puppet-apply index 9a83d283c6..4fc8a6b11c 100755 --- a/scripts/zulip-puppet-apply +++ b/scripts/zulip-puppet-apply @@ -17,11 +17,11 @@ config.read("/etc/zulip/zulip.conf") puppet_config = """ Exec { path => "/usr/sbin:/usr/bin:/sbin:/bin" } -class { 'apt': } +include apt """ for pclass in re.split(r'\s*,\s*', config.get('machine', 'puppet_classes')): - puppet_config += "class { '%s': }\n" % (pclass,) + puppet_config += "include %s\n" % (pclass,) puppet_cmd = ["puppet", "apply", "-e", puppet_config] puppet_cmd += extra_args