Use the root user to generate ring builder files

In Ubuntu, the swift user does not have write access to the /etc/swift
directory, so generating a ring builder file by the swift user fails
with Permission Error.

This change switches the execution user to root to avoid the error.

Closes-Bug: #1980613
Change-Id: Ibad7afb29007109a683e22a1119b5b5fbdb1c130
This commit is contained in:
Takashi Kajinami
2022-07-04 10:10:02 +09:00
parent e004e46273
commit d443048fae
3 changed files with 13 additions and 7 deletions

View File

@@ -12,7 +12,7 @@
# [*min_part_hours*] Time before a partition can be moved. # [*min_part_hours*] Time before a partition can be moved.
# Optional. Defaults to 24. # Optional. Defaults to 24.
# [*user*] User to run as # [*user*] User to run as
# Optional. Defaults to 'swift' # Optional. Defaults to 'root'
# #
# == Examples # == Examples
@@ -21,7 +21,7 @@
# part_power => 19, # part_power => 19,
# replicas => 5, # replicas => 5,
# min_part_hours => 1, # min_part_hours => 1,
# user => 'swift', # user => 'root',
# } # }
# #
# == Authors # == Authors
@@ -33,10 +33,10 @@
# Copyright 2011 Puppetlabs Inc, unless otherwise noted. # Copyright 2011 Puppetlabs Inc, unless otherwise noted.
# #
define swift::ringbuilder::create( define swift::ringbuilder::create(
$part_power = 18, $part_power = 18,
$replicas = 3, $replicas = 3,
$min_part_hours = 24, $min_part_hours = 24,
$user = 'swift' $user = 'root'
) { ) {
include swift::deps include swift::deps

View File

@@ -0,0 +1,6 @@
---
fixes:
- |
Now the ``swift::ringbuilder::create`` defined type generates a ring
builder file by root user, instead of swift user, by default. Set the user
parameter if a different should be used.

View File

@@ -6,7 +6,7 @@ describe 'swift::ringbuilder::create' do
:part_power => 18, :part_power => 18,
:replicas => 3, :replicas => 3,
:min_part_hours => 24, :min_part_hours => 24,
:user => 'swift' :user => 'root'
} }
end end
@@ -22,7 +22,7 @@ describe 'swift::ringbuilder::create' do
{:part_power => 19, {:part_power => 19,
:replicas => 6, :replicas => 6,
:min_part_hours => 2, :min_part_hours => 2,
:user => 'root'}].each do |param_set| :user => 'swift'}].each do |param_set|
describe "when #{param_set == {} ? "using default" : "specifying"} class parameters" do describe "when #{param_set == {} ? "using default" : "specifying"} class parameters" do
let :param_hash do let :param_hash do