Get rid of script workaround for single command calls
... to simplify the command called by the exec resources. Change-Id: Ib7942c0795532bfe4448225fe64767dcebf1a537
This commit is contained in:
parent
67888b7f3c
commit
db8e683898
@ -52,12 +52,9 @@ define ceph::fs (
|
|||||||
Ceph::Pool<||> -> Exec["create-fs-${name}"]
|
Ceph::Pool<||> -> Exec["create-fs-${name}"]
|
||||||
|
|
||||||
exec { "create-fs-${name}":
|
exec { "create-fs-${name}":
|
||||||
command => "/bin/true # comment to satisfy puppet syntax requirements
|
command => "ceph fs new ${name} ${metadata_pool} ${data_pool}",
|
||||||
set -ex
|
unless => "ceph fs ls | grep 'name: ${name},'",
|
||||||
ceph fs new ${name} ${metadata_pool} ${data_pool}",
|
path => ['/bin', '/usr/bin'],
|
||||||
unless => "/bin/true # comment to satisfy puppet syntax requirements
|
|
||||||
set -ex
|
|
||||||
ceph fs ls | grep 'name: ${name},'",
|
|
||||||
timeout => $exec_timeout_real,
|
timeout => $exec_timeout_real,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,34 +72,25 @@ define ceph::pool (
|
|||||||
Ceph::Key<||> -> Exec["create-${name}"]
|
Ceph::Key<||> -> Exec["create-${name}"]
|
||||||
Ceph::Osd<||> -> Exec["create-${name}"]
|
Ceph::Osd<||> -> Exec["create-${name}"]
|
||||||
exec { "create-${name}":
|
exec { "create-${name}":
|
||||||
command => "/bin/true # comment to satisfy puppet syntax requirements
|
command => "ceph osd pool create ${name} ${pg_num}",
|
||||||
set -ex
|
unless => "ceph osd pool ls | grep -w '${name}'",
|
||||||
ceph osd pool create ${name} ${pg_num}",
|
path => ['/bin', '/usr/bin'],
|
||||||
unless => "/bin/true # comment to satisfy puppet syntax requirements
|
|
||||||
set -ex
|
|
||||||
ceph osd pool ls | grep -w '${name}'",
|
|
||||||
timeout => $exec_timeout_real,
|
timeout => $exec_timeout_real,
|
||||||
}
|
}
|
||||||
|
|
||||||
exec { "set-${name}-pg_num":
|
exec { "set-${name}-pg_num":
|
||||||
command => "/bin/true # comment to satisfy puppet syntax requirements
|
command => "ceph osd pool set ${name} pg_num ${pg_num}",
|
||||||
set -ex
|
unless => "test $(ceph osd pool get ${name} pg_num | sed 's/.*:\s*//g') -ge ${pg_num}",
|
||||||
ceph osd pool set ${name} pg_num ${pg_num}",
|
path => ['/bin', '/usr/bin'],
|
||||||
unless => "/bin/true # comment to satisfy puppet syntax requirements
|
|
||||||
set -ex
|
|
||||||
test $(ceph osd pool get ${name} pg_num | sed 's/.*:\s*//g') -ge ${pg_num}",
|
|
||||||
require => Exec["create-${name}"],
|
require => Exec["create-${name}"],
|
||||||
timeout => $exec_timeout_real,
|
timeout => $exec_timeout_real,
|
||||||
}
|
}
|
||||||
|
|
||||||
if $pgp_num {
|
if $pgp_num {
|
||||||
exec { "set-${name}-pgp_num":
|
exec { "set-${name}-pgp_num":
|
||||||
command => "/bin/true # comment to satisfy puppet syntax requirements
|
command => "ceph osd pool set ${name} pgp_num ${pgp_num}",
|
||||||
set -ex
|
unless => "test $(ceph osd pool get ${name} pgp_num | sed 's/.*:\s*//g') -ge ${pgp_num}",
|
||||||
ceph osd pool set ${name} pgp_num ${pgp_num}",
|
path => ['/bin', '/usr/bin'],
|
||||||
unless => "/bin/true # comment to satisfy puppet syntax requirements
|
|
||||||
set -ex
|
|
||||||
test $(ceph osd pool get ${name} pgp_num | sed 's/.*:\s*//g') -ge ${pgp_num}",
|
|
||||||
require => [Exec["create-${name}"], Exec["set-${name}-pg_num"]],
|
require => [Exec["create-${name}"], Exec["set-${name}-pg_num"]],
|
||||||
timeout => $exec_timeout_real,
|
timeout => $exec_timeout_real,
|
||||||
}
|
}
|
||||||
@ -107,12 +98,9 @@ test $(ceph osd pool get ${name} pgp_num | sed 's/.*:\s*//g') -ge ${pgp_num}",
|
|||||||
|
|
||||||
if $size {
|
if $size {
|
||||||
exec { "set-${name}-size":
|
exec { "set-${name}-size":
|
||||||
command => "/bin/true # comment to satisfy puppet syntax requirements
|
command => "ceph osd pool set ${name} size ${size}",
|
||||||
set -ex
|
unless => "test $(ceph osd pool get ${name} size | sed 's/.*:\s*//g') -eq ${size}",
|
||||||
ceph osd pool set ${name} size ${size}",
|
path => ['/bin', '/usr/bin'],
|
||||||
unless => "/bin/true # comment to satisfy puppet syntax requirements
|
|
||||||
set -ex
|
|
||||||
test $(ceph osd pool get ${name} size | sed 's/.*:\s*//g') -eq ${size}",
|
|
||||||
require => Exec["create-${name}"],
|
require => Exec["create-${name}"],
|
||||||
timeout => $exec_timeout_real,
|
timeout => $exec_timeout_real,
|
||||||
}
|
}
|
||||||
@ -120,12 +108,9 @@ test $(ceph osd pool get ${name} size | sed 's/.*:\s*//g') -eq ${size}",
|
|||||||
|
|
||||||
if $tag {
|
if $tag {
|
||||||
exec { "set-${name}-tag":
|
exec { "set-${name}-tag":
|
||||||
command => "/bin/true # comment to satisfy puppet syntax requirements
|
command => "ceph osd pool application enable ${name} ${tag}",
|
||||||
set -ex
|
unless => "ceph osd pool application get ${name} ${tag}",
|
||||||
ceph osd pool application enable ${name} ${tag}",
|
path => ['/bin', '/usr/bin'],
|
||||||
unless => "/bin/true # comment to satisfy puppet syntax requirements
|
|
||||||
set -ex
|
|
||||||
ceph osd pool application get ${name} ${tag}",
|
|
||||||
require => Exec["create-${name}"],
|
require => Exec["create-${name}"],
|
||||||
timeout => $exec_timeout_real,
|
timeout => $exec_timeout_real,
|
||||||
}
|
}
|
||||||
@ -134,12 +119,9 @@ ceph osd pool application get ${name} ${tag}",
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
exec { "delete-${name}":
|
exec { "delete-${name}":
|
||||||
command => "/bin/true # comment to satisfy puppet syntax requirements
|
command => "ceph osd pool delete ${name} ${name} --yes-i-really-really-mean-it",
|
||||||
set -ex
|
onlyif => "ceph osd pool ls | grep -w '${name}'",
|
||||||
ceph osd pool delete ${name} ${name} --yes-i-really-really-mean-it",
|
path => ['/bin', '/usr/bin'],
|
||||||
onlyif => "/bin/true # comment to satisfy puppet syntax requirements
|
|
||||||
set -ex
|
|
||||||
ceph osd pool ls | grep -w '${name}'",
|
|
||||||
timeout => $exec_timeout_real,
|
timeout => $exec_timeout_real,
|
||||||
} -> Ceph::Mon<| ensure == absent |>
|
} -> Ceph::Mon<| ensure == absent |>
|
||||||
|
|
||||||
|
@ -30,8 +30,9 @@ describe 'ceph::fs' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it { should contain_exec('create-fs-fsa').with(
|
it { should contain_exec('create-fs-fsa').with(
|
||||||
:command => "/bin/true # comment to satisfy puppet syntax requirements\nset -ex\nceph fs new fsa metadata_pool data_pool",
|
:command => "ceph fs new fsa metadata_pool data_pool",
|
||||||
:unless => "/bin/true # comment to satisfy puppet syntax requirements\nset -ex\nceph fs ls | grep 'name: fsa,'"
|
:unless => "ceph fs ls | grep 'name: fsa,'",
|
||||||
|
:path => ['/bin', '/usr/bin'],
|
||||||
)}
|
)}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -37,19 +37,24 @@ describe 'ceph::pool' do
|
|||||||
|
|
||||||
it {
|
it {
|
||||||
should contain_exec('create-volumes').with(
|
should contain_exec('create-volumes').with(
|
||||||
'command' => "/bin/true # comment to satisfy puppet syntax requirements\nset -ex\nceph osd pool create volumes 3"
|
:command => 'ceph osd pool create volumes 3',
|
||||||
|
:path => ['/bin', '/usr/bin'],
|
||||||
)
|
)
|
||||||
should contain_exec('set-volumes-pg_num').with(
|
should contain_exec('set-volumes-pg_num').with(
|
||||||
'command' => "/bin/true # comment to satisfy puppet syntax requirements\nset -ex\nceph osd pool set volumes pg_num 3"
|
:command => 'ceph osd pool set volumes pg_num 3',
|
||||||
|
:path => ['/bin', '/usr/bin'],
|
||||||
)
|
)
|
||||||
should contain_exec('set-volumes-pgp_num').with(
|
should contain_exec('set-volumes-pgp_num').with(
|
||||||
'command' => "/bin/true # comment to satisfy puppet syntax requirements\nset -ex\nceph osd pool set volumes pgp_num 4"
|
:command => 'ceph osd pool set volumes pgp_num 4',
|
||||||
|
:path => ['/bin', '/usr/bin'],
|
||||||
).that_requires('Exec[set-volumes-pg_num]')
|
).that_requires('Exec[set-volumes-pg_num]')
|
||||||
should contain_exec('set-volumes-size').with(
|
should contain_exec('set-volumes-size').with(
|
||||||
'command' => "/bin/true # comment to satisfy puppet syntax requirements\nset -ex\nceph osd pool set volumes size 2"
|
:command => 'ceph osd pool set volumes size 2',
|
||||||
|
:path => ['/bin', '/usr/bin'],
|
||||||
)
|
)
|
||||||
should contain_exec('set-volumes-tag').with(
|
should contain_exec('set-volumes-tag').with(
|
||||||
'command' => "/bin/true # comment to satisfy puppet syntax requirements\nset -ex\nceph osd pool application enable volumes rbd"
|
:command => 'ceph osd pool application enable volumes rbd',
|
||||||
|
:path => ['/bin', '/usr/bin'],
|
||||||
)
|
)
|
||||||
should_not contain_exec('delete-volumes')
|
should_not contain_exec('delete-volumes')
|
||||||
}
|
}
|
||||||
@ -69,7 +74,8 @@ describe 'ceph::pool' do
|
|||||||
it {
|
it {
|
||||||
should_not contain_exec('create-volumes')
|
should_not contain_exec('create-volumes')
|
||||||
should contain_exec('delete-volumes').with(
|
should contain_exec('delete-volumes').with(
|
||||||
'command' => "/bin/true # comment to satisfy puppet syntax requirements\nset -ex\nceph osd pool delete volumes volumes --yes-i-really-really-mean-it"
|
:command => 'ceph osd pool delete volumes volumes --yes-i-really-really-mean-it',
|
||||||
|
:path => ['/bin', '/usr/bin'],
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user