Gilles has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/399398 )
Change subject: Fix Swift role for Stretch ...................................................................... Fix Swift role for Stretch The new environment doesn’t like unqualified resource names and doesn’t propagate variable context all the way to the system service template. Since we don’t really need that, I’ve worked around it. Bug: T183354 Change-Id: I6b6dc1eab2f2da4eca241020ccf0ccd752a278fd --- M puppet/hieradata/common.yaml M puppet/modules/swift/manifests/init.pp M puppet/modules/swift/manifests/ring.pp M puppet/modules/swift/manifests/service.pp M puppet/modules/swift/templates/ring.conf.erb M puppet/modules/swift/templates/systemd/swift.erb 6 files changed, 43 insertions(+), 99 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/vagrant refs/changes/98/399398/1 diff --git a/puppet/hieradata/common.yaml b/puppet/hieradata/common.yaml index d0640d8..cd2685a 100644 --- a/puppet/hieradata/common.yaml +++ b/puppet/hieradata/common.yaml @@ -481,10 +481,6 @@ swift::project: testproj swift::user: testuser swift::cfg_file: /etc/swift/swift.conf -swift::proxy_cfg_file: /etc/swift/proxy-server.conf -swift::account_cfg_file: /etc/swift/account-server.conf -swift::object_cfg_file: /etc/swift/object-server.conf -swift::container_cfg_file: /etc/swift/container-server.conf three_d::three_d_2png_dir: /srv/3d2png diff --git a/puppet/modules/swift/manifests/init.pp b/puppet/modules/swift/manifests/init.pp index 51c3bfc..00d792b 100644 --- a/puppet/modules/swift/manifests/init.pp +++ b/puppet/modules/swift/manifests/init.pp @@ -22,18 +22,6 @@ # [*cfg_file*] # Swift configuration file. The file will be generated by Puppet. # -# [*proxy_cfg_file*] -# Swift proxy server configuration file. The file will be generated by Puppet. -# -# [*account_cfg_file*] -# Swift account server configuration file. The file will be generated by Puppet. -# -# [*object_cfg_file*] -# Swift object server configuration file. The file will be generated by Puppet. -# -# [*container_cfg_file*] -# Swift container server configuration file. The file will be generated by Puppet. -# class swift ( $storage_dir, $port, @@ -41,10 +29,6 @@ $project, $user, $cfg_file, - $proxy_cfg_file, - $account_cfg_file, - $object_cfg_file, - $container_cfg_file, ) { include ::apache::mod::proxy include ::apache::mod::proxy_http @@ -103,7 +87,7 @@ mode => '0644', } - file { $proxy_cfg_file: + file { '/etc/swift/proxy.conf': ensure => present, group => 'www-data', content => template('swift/proxy-server.conf.erb'), @@ -119,97 +103,77 @@ require => Package['python-webob'], } - swift::ring { $account_cfg_file: - ring_type => 'account', - cfg_file => $account_cfg_file, + swift::ring { 'account': storage_dir => $storage_dir, ring_port => 6010, require => Package['swift-account'], } - swift::ring { $object_cfg_file: - ring_type => 'object', - cfg_file => $object_cfg_file, + swift::ring { 'object': storage_dir => $storage_dir, ring_port => 6020, require => Package['swift-object'], } - swift::ring { $container_cfg_file: - ring_type => 'container', - cfg_file => $container_cfg_file, + swift::ring { 'container': storage_dir => $storage_dir, ring_port => 6030, require => Package['swift-container'], } swift::service { 'account-server': - cfg_file => $account_cfg_file, - require => Ring[$account_cfg_file], + require => Swift::Ring['account'], } swift::service { 'account-auditor': - cfg_file => $account_cfg_file, - require => Ring[$account_cfg_file], + require => Swift::Ring['account'], } swift::service { 'account-reaper': - cfg_file => $account_cfg_file, - require => Ring[$account_cfg_file], + require => Swift::Ring['account'], } swift::service { 'account-replicator': - cfg_file => $account_cfg_file, - require => Ring[$account_cfg_file], + require => Swift::Ring['account'], } swift::service { 'container-server': - cfg_file => $container_cfg_file, - require => Ring[$container_cfg_file], + require => Swift::Ring['container'], } swift::service { 'container-auditor': - cfg_file => $container_cfg_file, - require => Ring[$container_cfg_file], + require => Swift::Ring['container'], } swift::service { 'container-replicator': - cfg_file => $container_cfg_file, - require => Ring[$container_cfg_file], + require => Swift::Ring['container'], } swift::service { 'container-sync': - cfg_file => $container_cfg_file, - require => Ring[$container_cfg_file], + require => Swift::Ring['container'], } swift::service { 'container-updater': - cfg_file => $container_cfg_file, - require => Ring[$container_cfg_file], + require => Swift::Ring['container'], } swift::service { 'object-server': - cfg_file => $object_cfg_file, - require => Ring[$object_cfg_file], + require => Swift::Ring['object'], } swift::service { 'object-auditor': - cfg_file => $object_cfg_file, - require => Ring[$object_cfg_file], + require => Swift::Ring['object'], } swift::service { 'object-replicator': - cfg_file => $object_cfg_file, - require => Ring[$object_cfg_file], + require => Swift::Ring['object'], } swift::service { 'object-updater': - cfg_file => $object_cfg_file, - require => Ring[$object_cfg_file], + require => Swift::Ring['object'], } swift::service { 'proxy-server': - cfg_file => $proxy_cfg_file, require => File['/usr/local/lib/python2.7/dist-packages/wmf/'], subscribe => File['/usr/local/lib/python2.7/dist-packages/wmf/'], } diff --git a/puppet/modules/swift/manifests/ring.pp b/puppet/modules/swift/manifests/ring.pp index 152dbc0..f6dca20 100644 --- a/puppet/modules/swift/manifests/ring.pp +++ b/puppet/modules/swift/manifests/ring.pp @@ -4,12 +4,6 @@ # # === Parameters # -# [*ring_type*] -# The type of swift ring . -# -# [*cfg_file*] -# Path to the ring's config file. -# # [*storage_dir*] # Path to the swift storage directory. # @@ -19,46 +13,42 @@ # === Examples # # swift::ring { 'account': -# server_type => 'account', -# cfg_file => '/etc/swift/account-server.conf', # storage_dir => '/srv/swift', # ring_port => 6010, # } # define swift::ring( - $ring_type, - $cfg_file, $storage_dir, $ring_port ) { - file { $cfg_file: + file { "/etc/swift/${title}.conf": ensure => present, group => 'www-data', content => template('swift/ring.conf.erb'), mode => '0644', - notify => Exec["${ring_type}/create_ring"], + notify => Exec["${title}/create_ring"], } - exec { "${ring_type}/create_ring": - command => "swift-ring-builder ${ring_type}.builder create 18 1 1", + exec { "${title}/create_ring": + command => "swift-ring-builder ${title}.builder create 18 1 1", user => 'swift', cwd => '/etc/swift', - notify => Exec["${ring_type}/add_ring"], + notify => Exec["${title}/add_ring"], refreshonly => true, require => Package['swift'], } - exec { "${ring_type}/add_ring": - command => "swift-ring-builder ${ring_type}.builder add z1-127.0.0.1:${ring_port}/1 1", + exec { "${title}/add_ring": + command => "swift-ring-builder ${title}.builder add z1-127.0.0.1:${ring_port}/1 1", user => 'swift', cwd => '/etc/swift', - notify => Exec["${ring_type}/rebalance"], + notify => Exec["${title}/rebalance"], refreshonly => true, require => Package['swift'], } - exec { "${ring_type}/rebalance": - command => "swift-ring-builder ${ring_type}.builder rebalance", + exec { "${title}/rebalance": + command => "swift-ring-builder ${title}.builder rebalance", user => 'swift', cwd => '/etc/swift', refreshonly => true, diff --git a/puppet/modules/swift/manifests/service.pp b/puppet/modules/swift/manifests/service.pp index dccd97d..a991d3f 100644 --- a/puppet/modules/swift/manifests/service.pp +++ b/puppet/modules/swift/manifests/service.pp @@ -2,25 +2,19 @@ # # Defines a swift service. # -# === Parameters -# -# [*cfg_file*] -# Path to the service's config file. -# # === Examples # -# swift::service { 'swift-account-server': -# cfg_file => '/etc/swift/account-server.conf', -# } +# swift::service { 'swift-account-server' } # -define swift::service( - $cfg_file, -) { +define swift::service { + $split = split($title, '-') + $ring_name = $split[0] + systemd::service { "swift-${title}": ensure => 'present', - require => File[$cfg_file], + require => File["/etc/swift/${ring_name}.conf"], service_params => { - subscribe => File[$cfg_file], + subscribe => File["/etc/swift/${ring_name}.conf"], }, template_name => 'swift', } diff --git a/puppet/modules/swift/templates/ring.conf.erb b/puppet/modules/swift/templates/ring.conf.erb index 54986dd..e9968a5 100644 --- a/puppet/modules/swift/templates/ring.conf.erb +++ b/puppet/modules/swift/templates/ring.conf.erb @@ -8,22 +8,22 @@ bind_port = <%= @ring_port %> [pipeline:main] -pipeline = <%= @ring_type %>-server +pipeline = <%= @title %>-server -[app:<%= @ring_type %>-server] -use = egg:swift#<%= @ring_type %> +[app:<%= @title %>-server] +use = egg:swift#<%= @title %> # Only for object-server allowed_headers = content-disposition, content-encoding, x-delete-at, x-object-manifest, x-content-duration, x-content-dimensions, xkey -[<%= @ring_type %>-replicator] +[<%= @title %>-replicator] vm_test_mode = yes -[<%= @ring_type %>-updater] +[<%= @title %>-updater] -[<%= @ring_type %>-auditor] +[<%= @title %>-auditor] # Only for container-sync but avoid making more complex template logic -[<%= @ring_type %>-sync] +[<%= @title %>-sync] # Same for account-reaper -[<%= @ring_type %>-reaper] \ No newline at end of file +[<%= @title %>-reaper] \ No newline at end of file diff --git a/puppet/modules/swift/templates/systemd/swift.erb b/puppet/modules/swift/templates/systemd/swift.erb index dcbdf97..8e4ea14 100644 --- a/puppet/modules/swift/templates/systemd/swift.erb +++ b/puppet/modules/swift/templates/systemd/swift.erb @@ -5,7 +5,7 @@ [Service] SyslogIdentifier=<%= @title %> -ExecStart=/usr/bin/<%= @title %> <%= @cfg_file %> +ExecStart=/usr/bin/<%= @title %> /etc/swift/<%= @title.split('-')[1] %>.conf Restart=always [Install] -- To view, visit https://gerrit.wikimedia.org/r/399398 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6b6dc1eab2f2da4eca241020ccf0ccd752a278fd Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/vagrant Gerrit-Branch: master Gerrit-Owner: Gilles <gdu...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits