Merge "Use the common provider for libvirt daemons"
This commit is contained in:
commit
69a43c97e1
@ -1,35 +1,8 @@
|
||||
Puppet::Type.type(:virtlockd_config).provide(
|
||||
:ini_setting,
|
||||
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
|
||||
:parent => Puppet::Type.type(:libvirtd_config).provider(:ini_setting)
|
||||
) do
|
||||
|
||||
def exists?
|
||||
if resource[:value] == ensure_absent_val
|
||||
resource[:ensure] = :absent
|
||||
elsif resource[:quote]
|
||||
unless resource[:value].start_with?('"')
|
||||
resource[:value] = '"' + resource[:value] + '"'
|
||||
end
|
||||
end
|
||||
super
|
||||
end
|
||||
|
||||
def section
|
||||
''
|
||||
end
|
||||
|
||||
def setting
|
||||
resource[:name]
|
||||
end
|
||||
|
||||
def separator
|
||||
'='
|
||||
end
|
||||
|
||||
def ensure_absent_val
|
||||
resource[:ensure_absent_val]
|
||||
end
|
||||
|
||||
def self.file_path
|
||||
'/etc/libvirt/virtlockd.conf'
|
||||
end
|
||||
|
@ -1,35 +1,8 @@
|
||||
Puppet::Type.type(:virtlogd_config).provide(
|
||||
:ini_setting,
|
||||
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
|
||||
:parent => Puppet::Type.type(:libvirtd_config).provider(:ini_setting)
|
||||
) do
|
||||
|
||||
def exists?
|
||||
if resource[:value] == ensure_absent_val
|
||||
resource[:ensure] = :absent
|
||||
elsif resource[:quote]
|
||||
unless resource[:value].start_with?('"')
|
||||
resource[:value] = '"' + resource[:value] + '"'
|
||||
end
|
||||
end
|
||||
super
|
||||
end
|
||||
|
||||
def section
|
||||
''
|
||||
end
|
||||
|
||||
def setting
|
||||
resource[:name]
|
||||
end
|
||||
|
||||
def separator
|
||||
'='
|
||||
end
|
||||
|
||||
def ensure_absent_val
|
||||
resource[:ensure_absent_val]
|
||||
end
|
||||
|
||||
def self.file_path
|
||||
'/etc/libvirt/virtlogd.conf'
|
||||
end
|
||||
|
@ -1,35 +1,8 @@
|
||||
Puppet::Type.type(:virtnodedevd_config).provide(
|
||||
:ini_setting,
|
||||
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
|
||||
:parent => Puppet::Type.type(:libvirtd_config).provider(:ini_setting)
|
||||
) do
|
||||
|
||||
def exists?
|
||||
if resource[:value] == ensure_absent_val
|
||||
resource[:ensure] = :absent
|
||||
elsif resource[:quote]
|
||||
unless resource[:value].start_with?('"')
|
||||
resource[:value] = '"' + resource[:value] + '"'
|
||||
end
|
||||
end
|
||||
super
|
||||
end
|
||||
|
||||
def section
|
||||
''
|
||||
end
|
||||
|
||||
def setting
|
||||
resource[:name]
|
||||
end
|
||||
|
||||
def separator
|
||||
'='
|
||||
end
|
||||
|
||||
def ensure_absent_val
|
||||
resource[:ensure_absent_val]
|
||||
end
|
||||
|
||||
def self.file_path
|
||||
'/etc/libvirt/virtnodedevd.conf'
|
||||
end
|
||||
|
@ -1,35 +1,8 @@
|
||||
Puppet::Type.type(:virtproxyd_config).provide(
|
||||
:ini_setting,
|
||||
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
|
||||
:parent => Puppet::Type.type(:libvirtd_config).provider(:ini_setting)
|
||||
) do
|
||||
|
||||
def exists?
|
||||
if resource[:value] == ensure_absent_val
|
||||
resource[:ensure] = :absent
|
||||
elsif resource[:quote]
|
||||
unless resource[:value].start_with?('"')
|
||||
resource[:value] = '"' + resource[:value] + '"'
|
||||
end
|
||||
end
|
||||
super
|
||||
end
|
||||
|
||||
def section
|
||||
''
|
||||
end
|
||||
|
||||
def setting
|
||||
resource[:name]
|
||||
end
|
||||
|
||||
def separator
|
||||
'='
|
||||
end
|
||||
|
||||
def ensure_absent_val
|
||||
resource[:ensure_absent_val]
|
||||
end
|
||||
|
||||
def self.file_path
|
||||
'/etc/libvirt/virtproxyd.conf'
|
||||
end
|
||||
|
@ -1,35 +1,8 @@
|
||||
Puppet::Type.type(:virtqemud_config).provide(
|
||||
:ini_setting,
|
||||
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
|
||||
:parent => Puppet::Type.type(:libvirtd_config).provider(:ini_setting)
|
||||
) do
|
||||
|
||||
def exists?
|
||||
if resource[:value] == ensure_absent_val
|
||||
resource[:ensure] = :absent
|
||||
elsif resource[:quote]
|
||||
unless resource[:value].start_with?('"')
|
||||
resource[:value] = '"' + resource[:value] + '"'
|
||||
end
|
||||
end
|
||||
super
|
||||
end
|
||||
|
||||
def section
|
||||
''
|
||||
end
|
||||
|
||||
def setting
|
||||
resource[:name]
|
||||
end
|
||||
|
||||
def separator
|
||||
'='
|
||||
end
|
||||
|
||||
def ensure_absent_val
|
||||
resource[:ensure_absent_val]
|
||||
end
|
||||
|
||||
def self.file_path
|
||||
'/etc/libvirt/virtqemud.conf'
|
||||
end
|
||||
|
@ -1,35 +1,8 @@
|
||||
Puppet::Type.type(:virtsecretd_config).provide(
|
||||
:ini_setting,
|
||||
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
|
||||
:parent => Puppet::Type.type(:libvirtd_config).provider(:ini_setting)
|
||||
) do
|
||||
|
||||
def exists?
|
||||
if resource[:value] == ensure_absent_val
|
||||
resource[:ensure] = :absent
|
||||
elsif resource[:quote]
|
||||
unless resource[:value].start_with?('"')
|
||||
resource[:value] = '"' + resource[:value] + '"'
|
||||
end
|
||||
end
|
||||
super
|
||||
end
|
||||
|
||||
def section
|
||||
''
|
||||
end
|
||||
|
||||
def setting
|
||||
resource[:name]
|
||||
end
|
||||
|
||||
def separator
|
||||
'='
|
||||
end
|
||||
|
||||
def ensure_absent_val
|
||||
resource[:ensure_absent_val]
|
||||
end
|
||||
|
||||
def self.file_path
|
||||
'/etc/libvirt/virtsecretd.conf'
|
||||
end
|
||||
|
@ -1,38 +1,10 @@
|
||||
Puppet::Type.type(:virtstoraged_config).provide(
|
||||
:ini_setting,
|
||||
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
|
||||
:parent => Puppet::Type.type(:libvirtd_config).provider(:ini_setting)
|
||||
) do
|
||||
|
||||
def exists?
|
||||
if resource[:value] == ensure_absent_val
|
||||
resource[:ensure] = :absent
|
||||
elsif resource[:quote]
|
||||
unless resource[:value].start_with?('"')
|
||||
resource[:value] = '"' + resource[:value] + '"'
|
||||
end
|
||||
end
|
||||
super
|
||||
end
|
||||
|
||||
def section
|
||||
''
|
||||
end
|
||||
|
||||
def setting
|
||||
resource[:name]
|
||||
end
|
||||
|
||||
def separator
|
||||
'='
|
||||
end
|
||||
|
||||
def ensure_absent_val
|
||||
resource[:ensure_absent_val]
|
||||
end
|
||||
|
||||
def self.file_path
|
||||
'/etc/libvirt/virtstoraged.conf'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
@ -1,69 +0,0 @@
|
||||
#
|
||||
# these tests are a little concerning b/c they are hacking around the
|
||||
# modulepath, so these tests will not catch issues that may eventually arise
|
||||
# related to loading these plugins.
|
||||
# I could not, for the life of me, figure out how to programmatically set the modulepath
|
||||
$LOAD_PATH.push(
|
||||
File.join(
|
||||
File.dirname(__FILE__),
|
||||
'..',
|
||||
'..',
|
||||
'..',
|
||||
'fixtures',
|
||||
'modules',
|
||||
'inifile',
|
||||
'lib')
|
||||
)
|
||||
require 'spec_helper'
|
||||
provider_class = Puppet::Type.type(:virtlockd_config).provider(:ini_setting)
|
||||
describe provider_class do
|
||||
|
||||
it 'should allow setting to be set explicitly' do
|
||||
resource = Puppet::Type::Virtlockd_config.new(
|
||||
{:name => 'foo', :value => 'bar'}
|
||||
)
|
||||
provider = provider_class.new(resource)
|
||||
expect(provider.section).to eq('')
|
||||
expect(provider.setting).to eq('foo')
|
||||
end
|
||||
|
||||
it 'should quote the value when quote is true' do
|
||||
resource = Puppet::Type::Virtlockd_config.new(
|
||||
{:name => 'foo', :value => 'baa', :quote => true }
|
||||
)
|
||||
provider = provider_class.new(resource)
|
||||
provider.exists?
|
||||
expect(provider.section).to eq('')
|
||||
expect(provider.setting).to eq('foo')
|
||||
expect(resource[:value]).to eq('"baa"')
|
||||
end
|
||||
|
||||
it 'should not quote the value when quote is true but the value is quoted' do
|
||||
resource = Puppet::Type::Virtlockd_config.new(
|
||||
{:name => 'foo', :value => '"baa"', :quote => true }
|
||||
)
|
||||
provider = provider_class.new(resource)
|
||||
provider.exists?
|
||||
expect(provider.section).to eq('')
|
||||
expect(provider.setting).to eq('foo')
|
||||
expect(resource[:value]).to eq('"baa"')
|
||||
end
|
||||
|
||||
it 'should ensure absent when <SERVICE DEFAULT> is specified as a value' do
|
||||
resource = Puppet::Type::Virtlockd_config.new(
|
||||
{:name => 'foo', :value => '<SERVICE DEFAULT>'}
|
||||
)
|
||||
provider = provider_class.new(resource)
|
||||
provider.exists?
|
||||
expect(resource[:ensure]).to eq :absent
|
||||
end
|
||||
|
||||
it 'should ensure absent when <SERVICE DEFAULT> is specified as a value and quote is true' do
|
||||
resource = Puppet::Type::Virtlockd_config.new(
|
||||
{:name => 'foo', :value => '<SERVICE DEFAULT>', :quote => true}
|
||||
)
|
||||
provider = provider_class.new(resource)
|
||||
provider.exists?
|
||||
expect(resource[:ensure]).to eq :absent
|
||||
end
|
||||
end
|
@ -1,69 +0,0 @@
|
||||
#
|
||||
# these tests are a little concerning b/c they are hacking around the
|
||||
# modulepath, so these tests will not catch issues that may eventually arise
|
||||
# related to loading these plugins.
|
||||
# I could not, for the life of me, figure out how to programmatically set the modulepath
|
||||
$LOAD_PATH.push(
|
||||
File.join(
|
||||
File.dirname(__FILE__),
|
||||
'..',
|
||||
'..',
|
||||
'..',
|
||||
'fixtures',
|
||||
'modules',
|
||||
'inifile',
|
||||
'lib')
|
||||
)
|
||||
require 'spec_helper'
|
||||
provider_class = Puppet::Type.type(:virtlogd_config).provider(:ini_setting)
|
||||
describe provider_class do
|
||||
|
||||
it 'should allow setting to be set explicitly' do
|
||||
resource = Puppet::Type::Virtlogd_config.new(
|
||||
{:name => 'foo', :value => 'bar'}
|
||||
)
|
||||
provider = provider_class.new(resource)
|
||||
expect(provider.section).to eq('')
|
||||
expect(provider.setting).to eq('foo')
|
||||
end
|
||||
|
||||
it 'should quote the value when quote is true' do
|
||||
resource = Puppet::Type::Virtlogd_config.new(
|
||||
{:name => 'foo', :value => 'baa', :quote => true }
|
||||
)
|
||||
provider = provider_class.new(resource)
|
||||
provider.exists?
|
||||
expect(provider.section).to eq('')
|
||||
expect(provider.setting).to eq('foo')
|
||||
expect(resource[:value]).to eq('"baa"')
|
||||
end
|
||||
|
||||
it 'should not quote the value when quote is true but the value is quoted' do
|
||||
resource = Puppet::Type::Virtlogd_config.new(
|
||||
{:name => 'foo', :value => '"baa"', :quote => true }
|
||||
)
|
||||
provider = provider_class.new(resource)
|
||||
provider.exists?
|
||||
expect(provider.section).to eq('')
|
||||
expect(provider.setting).to eq('foo')
|
||||
expect(resource[:value]).to eq('"baa"')
|
||||
end
|
||||
|
||||
it 'should ensure absent when <SERVICE DEFAULT> is specified as a value' do
|
||||
resource = Puppet::Type::Virtlogd_config.new(
|
||||
{:name => 'foo', :value => '<SERVICE DEFAULT>'}
|
||||
)
|
||||
provider = provider_class.new(resource)
|
||||
provider.exists?
|
||||
expect(resource[:ensure]).to eq :absent
|
||||
end
|
||||
|
||||
it 'should ensure absent when <SERVICE DEFAULT> is specified as a value and quote is true' do
|
||||
resource = Puppet::Type::Virtlogd_config.new(
|
||||
{:name => 'foo', :value => '<SERVICE DEFAULT>', :quote => true}
|
||||
)
|
||||
provider = provider_class.new(resource)
|
||||
provider.exists?
|
||||
expect(resource[:ensure]).to eq :absent
|
||||
end
|
||||
end
|
@ -1,66 +0,0 @@
|
||||
|
||||
#
|
||||
# these tests are a little concerning b/c they are hacking around the
|
||||
# modulepath, so these tests will not catch issues that may eventually arise
|
||||
# related to loading these plugins.
|
||||
# I could not, for the life of me, figure out how to programmatically set the modulepath
|
||||
$LOAD_PATH.push(
|
||||
File.join(
|
||||
File.dirname(__FILE__),
|
||||
'..',
|
||||
'..',
|
||||
'..',
|
||||
'fixtures',
|
||||
'modules',
|
||||
'inifile',
|
||||
'lib')
|
||||
)
|
||||
require 'spec_helper'
|
||||
provider_class = Puppet::Type.type(:virtnodedevd_config).provider(:ini_setting)
|
||||
describe provider_class do
|
||||
it 'should allow setting to be set explicitly' do
|
||||
resource = Puppet::Type::Virtnodedevd_config.new(
|
||||
{:name => 'foo', :value => 'bar'}
|
||||
)
|
||||
provider = provider_class.new(resource)
|
||||
expect(provider.section).to eq('')
|
||||
expect(provider.setting).to eq('foo')
|
||||
end
|
||||
it 'should quote the value when quote is true' do
|
||||
resource = Puppet::Type::Virtnodedevd_config.new(
|
||||
{:name => 'foo', :value => 'baa', :quote => true }
|
||||
)
|
||||
provider = provider_class.new(resource)
|
||||
provider.exists?
|
||||
expect(provider.section).to eq('')
|
||||
expect(provider.setting).to eq('foo')
|
||||
expect(resource[:value]).to eq('"baa"')
|
||||
end
|
||||
it 'should not quote the value when quote is true but the value is quoted' do
|
||||
resource = Puppet::Type::Virtnodedevd_config.new(
|
||||
{:name => 'foo', :value => '"baa"', :quote => true }
|
||||
)
|
||||
provider = provider_class.new(resource)
|
||||
provider.exists?
|
||||
expect(provider.section).to eq('')
|
||||
expect(provider.setting).to eq('foo')
|
||||
expect(resource[:value]).to eq('"baa"')
|
||||
end
|
||||
it 'should ensure absent when <SERVICE DEFAULT> is specified as a value' do
|
||||
resource = Puppet::Type::Virtnodedevd_config.new(
|
||||
{:name => 'foo', :value => '<SERVICE DEFAULT>'}
|
||||
)
|
||||
provider = provider_class.new(resource)
|
||||
provider.exists?
|
||||
expect(resource[:ensure]).to eq :absent
|
||||
end
|
||||
it 'should ensure absent when <SERVICE DEFAULT> is specified as a value and quote is true' do
|
||||
resource = Puppet::Type::Virtnodedevd_config.new(
|
||||
{:name => 'foo', :value => '<SERVICE DEFAULT>', :quote => true}
|
||||
)
|
||||
provider = provider_class.new(resource)
|
||||
provider.exists?
|
||||
expect(resource[:ensure]).to eq :absent
|
||||
end
|
||||
end
|
||||
|
@ -1,66 +0,0 @@
|
||||
|
||||
#
|
||||
# these tests are a little concerning b/c they are hacking around the
|
||||
# modulepath, so these tests will not catch issues that may eventually arise
|
||||
# related to loading these plugins.
|
||||
# I could not, for the life of me, figure out how to programmatically set the modulepath
|
||||
$LOAD_PATH.push(
|
||||
File.join(
|
||||
File.dirname(__FILE__),
|
||||
'..',
|
||||
'..',
|
||||
'..',
|
||||
'fixtures',
|
||||
'modules',
|
||||
'inifile',
|
||||
'lib')
|
||||
)
|
||||
require 'spec_helper'
|
||||
provider_class = Puppet::Type.type(:virtproxyd_config).provider(:ini_setting)
|
||||
describe provider_class do
|
||||
it 'should allow setting to be set explicitly' do
|
||||
resource = Puppet::Type::Virtproxyd_config.new(
|
||||
{:name => 'foo', :value => 'bar'}
|
||||
)
|
||||
provider = provider_class.new(resource)
|
||||
expect(provider.section).to eq('')
|
||||
expect(provider.setting).to eq('foo')
|
||||
end
|
||||
it 'should quote the value when quote is true' do
|
||||
resource = Puppet::Type::Virtproxyd_config.new(
|
||||
{:name => 'foo', :value => 'baa', :quote => true }
|
||||
)
|
||||
provider = provider_class.new(resource)
|
||||
provider.exists?
|
||||
expect(provider.section).to eq('')
|
||||
expect(provider.setting).to eq('foo')
|
||||
expect(resource[:value]).to eq('"baa"')
|
||||
end
|
||||
it 'should not quote the value when quote is true but the value is quoted' do
|
||||
resource = Puppet::Type::Virtproxyd_config.new(
|
||||
{:name => 'foo', :value => '"baa"', :quote => true }
|
||||
)
|
||||
provider = provider_class.new(resource)
|
||||
provider.exists?
|
||||
expect(provider.section).to eq('')
|
||||
expect(provider.setting).to eq('foo')
|
||||
expect(resource[:value]).to eq('"baa"')
|
||||
end
|
||||
it 'should ensure absent when <SERVICE DEFAULT> is specified as a value' do
|
||||
resource = Puppet::Type::Virtproxyd_config.new(
|
||||
{:name => 'foo', :value => '<SERVICE DEFAULT>'}
|
||||
)
|
||||
provider = provider_class.new(resource)
|
||||
provider.exists?
|
||||
expect(resource[:ensure]).to eq :absent
|
||||
end
|
||||
it 'should ensure absent when <SERVICE DEFAULT> is specified as a value and quote is true' do
|
||||
resource = Puppet::Type::Virtproxyd_config.new(
|
||||
{:name => 'foo', :value => '<SERVICE DEFAULT>', :quote => true}
|
||||
)
|
||||
provider = provider_class.new(resource)
|
||||
provider.exists?
|
||||
expect(resource[:ensure]).to eq :absent
|
||||
end
|
||||
end
|
||||
|
@ -1,66 +0,0 @@
|
||||
|
||||
#
|
||||
# these tests are a little concerning b/c they are hacking around the
|
||||
# modulepath, so these tests will not catch issues that may eventually arise
|
||||
# related to loading these plugins.
|
||||
# I could not, for the life of me, figure out how to programmatically set the modulepath
|
||||
$LOAD_PATH.push(
|
||||
File.join(
|
||||
File.dirname(__FILE__),
|
||||
'..',
|
||||
'..',
|
||||
'..',
|
||||
'fixtures',
|
||||
'modules',
|
||||
'inifile',
|
||||
'lib')
|
||||
)
|
||||
require 'spec_helper'
|
||||
provider_class = Puppet::Type.type(:virtqemud_config).provider(:ini_setting)
|
||||
describe provider_class do
|
||||
it 'should allow setting to be set explicitly' do
|
||||
resource = Puppet::Type::Virtqemud_config.new(
|
||||
{:name => 'foo', :value => 'bar'}
|
||||
)
|
||||
provider = provider_class.new(resource)
|
||||
expect(provider.section).to eq('')
|
||||
expect(provider.setting).to eq('foo')
|
||||
end
|
||||
it 'should quote the value when quote is true' do
|
||||
resource = Puppet::Type::Virtqemud_config.new(
|
||||
{:name => 'foo', :value => 'baa', :quote => true }
|
||||
)
|
||||
provider = provider_class.new(resource)
|
||||
provider.exists?
|
||||
expect(provider.section).to eq('')
|
||||
expect(provider.setting).to eq('foo')
|
||||
expect(resource[:value]).to eq('"baa"')
|
||||
end
|
||||
it 'should not quote the value when quote is true but the value is quoted' do
|
||||
resource = Puppet::Type::Virtqemud_config.new(
|
||||
{:name => 'foo', :value => '"baa"', :quote => true }
|
||||
)
|
||||
provider = provider_class.new(resource)
|
||||
provider.exists?
|
||||
expect(provider.section).to eq('')
|
||||
expect(provider.setting).to eq('foo')
|
||||
expect(resource[:value]).to eq('"baa"')
|
||||
end
|
||||
it 'should ensure absent when <SERVICE DEFAULT> is specified as a value' do
|
||||
resource = Puppet::Type::Virtqemud_config.new(
|
||||
{:name => 'foo', :value => '<SERVICE DEFAULT>'}
|
||||
)
|
||||
provider = provider_class.new(resource)
|
||||
provider.exists?
|
||||
expect(resource[:ensure]).to eq :absent
|
||||
end
|
||||
it 'should ensure absent when <SERVICE DEFAULT> is specified as a value and quote is true' do
|
||||
resource = Puppet::Type::Virtqemud_config.new(
|
||||
{:name => 'foo', :value => '<SERVICE DEFAULT>', :quote => true}
|
||||
)
|
||||
provider = provider_class.new(resource)
|
||||
provider.exists?
|
||||
expect(resource[:ensure]).to eq :absent
|
||||
end
|
||||
end
|
||||
|
@ -1,66 +0,0 @@
|
||||
|
||||
#
|
||||
# these tests are a little concerning b/c they are hacking around the
|
||||
# modulepath, so these tests will not catch issues that may eventually arise
|
||||
# related to loading these plugins.
|
||||
# I could not, for the life of me, figure out how to programmatically set the modulepath
|
||||
$LOAD_PATH.push(
|
||||
File.join(
|
||||
File.dirname(__FILE__),
|
||||
'..',
|
||||
'..',
|
||||
'..',
|
||||
'fixtures',
|
||||
'modules',
|
||||
'inifile',
|
||||
'lib')
|
||||
)
|
||||
require 'spec_helper'
|
||||
provider_class = Puppet::Type.type(:virtsecretd_config).provider(:ini_setting)
|
||||
describe provider_class do
|
||||
it 'should allow setting to be set explicitly' do
|
||||
resource = Puppet::Type::Virtsecretd_config.new(
|
||||
{:name => 'foo', :value => 'bar'}
|
||||
)
|
||||
provider = provider_class.new(resource)
|
||||
expect(provider.section).to eq('')
|
||||
expect(provider.setting).to eq('foo')
|
||||
end
|
||||
it 'should quote the value when quote is true' do
|
||||
resource = Puppet::Type::Virtsecretd_config.new(
|
||||
{:name => 'foo', :value => 'baa', :quote => true }
|
||||
)
|
||||
provider = provider_class.new(resource)
|
||||
provider.exists?
|
||||
expect(provider.section).to eq('')
|
||||
expect(provider.setting).to eq('foo')
|
||||
expect(resource[:value]).to eq('"baa"')
|
||||
end
|
||||
it 'should not quote the value when quote is true but the value is quoted' do
|
||||
resource = Puppet::Type::Virtsecretd_config.new(
|
||||
{:name => 'foo', :value => '"baa"', :quote => true }
|
||||
)
|
||||
provider = provider_class.new(resource)
|
||||
provider.exists?
|
||||
expect(provider.section).to eq('')
|
||||
expect(provider.setting).to eq('foo')
|
||||
expect(resource[:value]).to eq('"baa"')
|
||||
end
|
||||
it 'should ensure absent when <SERVICE DEFAULT> is specified as a value' do
|
||||
resource = Puppet::Type::Virtsecretd_config.new(
|
||||
{:name => 'foo', :value => '<SERVICE DEFAULT>'}
|
||||
)
|
||||
provider = provider_class.new(resource)
|
||||
provider.exists?
|
||||
expect(resource[:ensure]).to eq :absent
|
||||
end
|
||||
it 'should ensure absent when <SERVICE DEFAULT> is specified as a value and quote is true' do
|
||||
resource = Puppet::Type::Virtsecretd_config.new(
|
||||
{:name => 'foo', :value => '<SERVICE DEFAULT>', :quote => true}
|
||||
)
|
||||
provider = provider_class.new(resource)
|
||||
provider.exists?
|
||||
expect(resource[:ensure]).to eq :absent
|
||||
end
|
||||
end
|
||||
|
@ -1,66 +0,0 @@
|
||||
|
||||
#
|
||||
# these tests are a little concerning b/c they are hacking around the
|
||||
# modulepath, so these tests will not catch issues that may eventually arise
|
||||
# related to loading these plugins.
|
||||
# I could not, for the life of me, figure out how to programmatically set the modulepath
|
||||
$LOAD_PATH.push(
|
||||
File.join(
|
||||
File.dirname(__FILE__),
|
||||
'..',
|
||||
'..',
|
||||
'..',
|
||||
'fixtures',
|
||||
'modules',
|
||||
'inifile',
|
||||
'lib')
|
||||
)
|
||||
require 'spec_helper'
|
||||
provider_class = Puppet::Type.type(:virtstoraged_config).provider(:ini_setting)
|
||||
describe provider_class do
|
||||
it 'should allow setting to be set explicitly' do
|
||||
resource = Puppet::Type::Virtstoraged_config.new(
|
||||
{:name => 'foo', :value => 'bar'}
|
||||
)
|
||||
provider = provider_class.new(resource)
|
||||
expect(provider.section).to eq('')
|
||||
expect(provider.setting).to eq('foo')
|
||||
end
|
||||
it 'should quote the value when quote is true' do
|
||||
resource = Puppet::Type::Virtstoraged_config.new(
|
||||
{:name => 'foo', :value => 'baa', :quote => true }
|
||||
)
|
||||
provider = provider_class.new(resource)
|
||||
provider.exists?
|
||||
expect(provider.section).to eq('')
|
||||
expect(provider.setting).to eq('foo')
|
||||
expect(resource[:value]).to eq('"baa"')
|
||||
end
|
||||
it 'should not quote the value when quote is true but the value is quoted' do
|
||||
resource = Puppet::Type::Virtstoraged_config.new(
|
||||
{:name => 'foo', :value => '"baa"', :quote => true }
|
||||
)
|
||||
provider = provider_class.new(resource)
|
||||
provider.exists?
|
||||
expect(provider.section).to eq('')
|
||||
expect(provider.setting).to eq('foo')
|
||||
expect(resource[:value]).to eq('"baa"')
|
||||
end
|
||||
it 'should ensure absent when <SERVICE DEFAULT> is specified as a value' do
|
||||
resource = Puppet::Type::Virtstoraged_config.new(
|
||||
{:name => 'foo', :value => '<SERVICE DEFAULT>'}
|
||||
)
|
||||
provider = provider_class.new(resource)
|
||||
provider.exists?
|
||||
expect(resource[:ensure]).to eq :absent
|
||||
end
|
||||
it 'should ensure absent when <SERVICE DEFAULT> is specified as a value and quote is true' do
|
||||
resource = Puppet::Type::Virtstoraged_config.new(
|
||||
{:name => 'foo', :value => '<SERVICE DEFAULT>', :quote => true}
|
||||
)
|
||||
provider = provider_class.new(resource)
|
||||
provider.exists?
|
||||
expect(resource[:ensure]).to eq :absent
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user