Debian Codegraph @

lib/puppet/provider/nova.rb

raw
1 require 'puppet/util/inifile'
2 require 'puppet/provider/openstack'
3 require 'puppet/provider/openstack/auth'
4
5 class Puppet::Provider::Nova < Puppet::Provider::Openstack
6
7 extend Puppet::Provider::Openstack::Auth
8
9 def self.nova_manage_request(*args)
10 # Not using the nova-manage command directly,
11 # so we can disable combining of stderr/stdout output.
12 args.unshift(Puppet::Util.which('nova-manage'))
13
14 # NOTE(mnaser): We pass the arguments as an array to avoid problems with
15 # symbols in the arguments breaking things.
16 Puppet::Util::Execution.execute(args, {
17 :uid => nova_user,
18 :failonfail => true,
19 :combine => false,
20 :custom_environment => {}
21 })
22 end
23
24 def nova_manage_request(*args)
25 self.class.nova_manage_request(args)
26 end
27
28 def self.nova_user
29 'nova'
30 end
31
32 def self.conf_filename
33 '/etc/nova/nova.conf'
34 end
35
36 def self.nova_conf
37 return @nova_conf if @nova_conf
38 @nova_conf = Puppet::Util::IniConfig::File.new
39 @nova_conf.read(conf_filename)
40 @nova_conf
41 end
42
43 def self.reset
44 @nova_conf = nil
45 end
46 end