File: nova.rb

package info (click to toggle)
puppet-module-nova 25.0.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,100 kB
  • sloc: ruby: 11,433; python: 38; sh: 10; makefile: 10
file content (46 lines) | stat: -rw-r--r-- 1,143 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
require 'puppet/util/inifile'
require 'puppet/provider/openstack'
require 'puppet/provider/openstack/auth'

class Puppet::Provider::Nova < Puppet::Provider::Openstack

  extend Puppet::Provider::Openstack::Auth

  def self.nova_manage_request(*args)
    # Not using the nova-manage command directly,
    # so we can disable combining of stderr/stdout output.
    args.unshift(Puppet::Util.which('nova-manage'))

    # NOTE(mnaser): We pass the arguments as an array to avoid problems with
    #               symbols in the arguments breaking things.
    Puppet::Util::Execution.execute(args, {
      :uid                => nova_user,
      :failonfail         => true,
      :combine            => false,
      :custom_environment => {}
    })
  end

  def nova_manage_request(*args)
    self.class.nova_manage_request(args)
  end

  def self.nova_user
    'nova'
  end

  def self.conf_filename
    '/etc/nova/nova.conf'
  end

  def self.nova_conf
    return @nova_conf if @nova_conf
    @nova_conf = Puppet::Util::IniConfig::File.new
    @nova_conf.read(conf_filename)
    @nova_conf
  end

  def self.reset
    @nova_conf = nil
  end
end