Skip to content

Commit

Permalink
remove legacy anchor resources
Browse files Browse the repository at this point in the history
  • Loading branch information
Lightning- committed Jan 30, 2024
1 parent 76fd058 commit 78b3ac6
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 35 deletions.
8 changes: 4 additions & 4 deletions manifests/config.pp
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -20,5 +21,4 @@
group => $thumbor::group,
mode => '0644',
}
-> anchor { 'thumbor::config::end': }
}
9 changes: 1 addition & 8 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
}
23 changes: 4 additions & 19 deletions manifests/install.pp
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 ? {
Expand All @@ -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'],
}

Expand All @@ -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': }
}
10 changes: 6 additions & 4 deletions manifests/service.pp
Original file line number Diff line number Diff line change
@@ -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'],
}
}
2 changes: 2 additions & 0 deletions manifests/upgrade.pp
Original file line number Diff line number Diff line change
@@ -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}"
Expand Down

0 comments on commit 78b3ac6

Please sign in to comment.