From 78b3ac64e46f651d957c4e1693e67a4715d5d2f6 Mon Sep 17 00:00:00 2001 From: Lightning Date: Tue, 30 Jan 2024 23:54:00 +0100 Subject: [PATCH] remove legacy anchor resources --- manifests/config.pp | 8 ++++---- manifests/init.pp | 9 +-------- manifests/install.pp | 23 ++++------------------- manifests/service.pp | 10 ++++++---- manifests/upgrade.pp | 2 ++ 5 files changed, 17 insertions(+), 35 deletions(-) diff --git a/manifests/config.pp b/manifests/config.pp index b91cad4..ace67a5 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -1,17 +1,18 @@ # @summary Setup configuration files for Thumbor # @api private class thumbor::config { + require('thumbor::install') + $_default_config = $thumbor::config - anchor { 'thumbor::config::begin': } - -> file { "${thumbor::cfg_path}/thumbor.key": + file { "${thumbor::cfg_path}/thumbor.key": ensure => $thumbor::ensure, content => $thumbor::security_key, owner => $thumbor::user, group => $thumbor::group, mode => '0600', } - -> file { "${thumbor::cfg_path}/thumbor.conf": + file { "${thumbor::cfg_path}/thumbor.conf": ensure => $thumbor::ensure, content => epp('thumbor/thumbor.conf.epp', { _default_config => $_default_config, @@ -20,5 +21,4 @@ group => $thumbor::group, mode => '0644', } - -> anchor { 'thumbor::config::end': } } diff --git a/manifests/init.pp b/manifests/init.pp index c359a43..a8a6511 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -112,12 +112,5 @@ $cfg_path = $config_dir } - anchor { 'thumbor::begin': } - -> class { 'thumbor::python': } - -> class { 'thumbor::user': } - -> class { 'thumbor::upgrade': } - -> class { 'thumbor::install': } - -> class { 'thumbor::config': } - -> class { 'thumbor::service': } - -> anchor { 'thumbor::end': } + include(['thumbor::python', 'thumbor::user', 'thumbor::upgrade', 'thumbor::install', 'thumbor::config', 'thumbor::service']) } diff --git a/manifests/install.pp b/manifests/install.pp index 5b5b7bf..143c689 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -1,7 +1,7 @@ # @summary Install packages and dependencies for Thumbor # @api private class thumbor::install { - anchor { 'thumbor::install::begin': } + require(['thumbor::python', 'thumbor::user', 'thumbor::upgrade']) if $thumbor::manage_epel and $facts['os']['family'] == 'RedHat' { require epel @@ -15,14 +15,9 @@ owner => $thumbor::user, group => $thumbor::group, require => Class['python'], - before => Anchor['thumbor::install::virtualenv'], + before => [Python::Pip[$thumbor::package_name], Python::Pip[[$thumbor::plugins]]], } } - anchor { 'thumbor::install::virtualenv': - require => Anchor['thumbor::install::begin'], - before => Anchor['thumbor::install::end'], - } - ensure_packages($thumbor::additional_packages) $venv = $thumbor::venv_path ? { @@ -35,11 +30,7 @@ virtualenv => $venv, pip_provider => $thumbor::pip_provider, proxy => $thumbor::pip_proxyserver, - require => [ - Package[$thumbor::additional_packages], - Anchor['thumbor::install::virtualenv'], - ], - before => Anchor['thumbor::install::end'], + require => Package[$thumbor::additional_packages], notify => Class['thumbor::service'], } @@ -48,13 +39,7 @@ virtualenv => $venv, pip_provider => $thumbor::pip_provider, proxy => $thumbor::pip_proxyserver, - require => [ - Package[$thumbor::additional_packages], - Anchor['thumbor::install::virtualenv'], - ], - before => Anchor['thumbor::install::end'], + require => Package[$thumbor::additional_packages], notify => Class['thumbor::service'], } - - anchor { 'thumbor::install::end': } } diff --git a/manifests/service.pp b/manifests/service.pp index 773f519..0cf46d4 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -1,10 +1,12 @@ # @summary Manage Thumbor system service and instances # @api private class thumbor::service { - anchor { 'thumbor::service::begin': } - -> systemd::unit_file { 'thumbor@.service': + require(['thumbor::install', 'thumbor::config']) + + systemd::unit_file { 'thumbor@.service': content => template('thumbor/thumbor.systemd.erb'), } - -> thumbor::service::systemd { [$thumbor::ports]: } - -> anchor { 'thumbor::service::end': } + thumbor::service::systemd { [$thumbor::ports]: + require => Systemd::Unit_file['thumbor@.service'], + } } diff --git a/manifests/upgrade.pp b/manifests/upgrade.pp index 3eec36e..b5716fc 100644 --- a/manifests/upgrade.pp +++ b/manifests/upgrade.pp @@ -1,6 +1,8 @@ # @summary Upgrade Thumbor's Python venv # @api private class thumbor::upgrade { + require(['thumbor::python', 'thumbor::user']) + # Only perform upgrades when using Python venv. if $thumbor::update_enabled and $thumbor::venv_path { $upgrade_statefile = "${thumbor::config_dir}/${thumbor::statefile}"