Module: VagrantPlugins::Openstack

Defined in:
lib/vagrant-openstack-provider.rb,
lib/vagrant-openstack-provider/utils.rb,
lib/vagrant-openstack-provider/action.rb,
lib/vagrant-openstack-provider/config.rb,
lib/vagrant-openstack-provider/errors.rb,
lib/vagrant-openstack-provider/plugin.rb,
lib/vagrant-openstack-provider/version.rb,
lib/vagrant-openstack-provider/provider.rb,
lib/vagrant-openstack-provider/client/nova.rb,
lib/vagrant-openstack-provider/command/main.rb,
lib/vagrant-openstack-provider/action/resume.rb,
lib/vagrant-openstack-provider/client/cinder.rb,
lib/vagrant-openstack-provider/client/domain.rb,
lib/vagrant-openstack-provider/command/reset.rb,
lib/vagrant-openstack-provider/command/utils.rb,
lib/vagrant-openstack-provider/action/message.rb,
lib/vagrant-openstack-provider/action/suspend.rb,
lib/vagrant-openstack-provider/client/neutron.rb,
lib/vagrant-openstack-provider/client/keystone.rb,
lib/vagrant-openstack-provider/config_resolver.rb,
lib/vagrant-openstack-provider/action/wait_stop.rb,
lib/vagrant-openstack-provider/client/openstack.rb,
lib/vagrant-openstack-provider/action/read_state.rb,
lib/vagrant-openstack-provider/client/http_utils.rb,
lib/vagrant-openstack-provider/action/stop_server.rb,
lib/vagrant-openstack-provider/action/wait_active.rb,
lib/vagrant-openstack-provider/command/image_list.rb,
lib/vagrant-openstack-provider/action/start_server.rb,
lib/vagrant-openstack-provider/action/sync_folders.rb,
lib/vagrant-openstack-provider/command/flavor_list.rb,
lib/vagrant-openstack-provider/command/volume_list.rb,
lib/vagrant-openstack-provider/action/create_server.rb,
lib/vagrant-openstack-provider/action/delete_server.rb,
lib/vagrant-openstack-provider/action/read_ssh_info.rb,
lib/vagrant-openstack-provider/command/network_list.rb,
lib/vagrant-openstack-provider/client/request_logger.rb,
lib/vagrant-openstack-provider/action/wait_accessible.rb,
lib/vagrant-openstack-provider/command/floatingip_list.rb,
lib/vagrant-openstack-provider/action/connect_openstack.rb,
lib/vagrant-openstack-provider/command/abstract_command.rb

Defined Under Namespace

Modules: Action, Command, Domain, Errors, HttpUtils Classes: CinderClient, Config, ConfigResolver, KeystoneClient, NeutronClient, NovaClient, Plugin, Provider, Session, Utils

Constant Summary collapse

VERSION =
'0.5.2'

Class Method Summary collapse

Class Method Details

.cinderObject



46
47
48
# File 'lib/vagrant-openstack-provider/client/openstack.rb', line 46

def self.cinder
  Openstack::CinderClient.instance
end

.init_i18nObject

This initializes the i18n load path so that the plugin-specific translations work.



12
13
14
15
# File 'lib/vagrant-openstack-provider.rb', line 12

def self.init_i18n
  I18n.load_path << File.expand_path('locales/en.yml', source_root)
  I18n.reload!
end

.init_loggingObject

This initializes the logging so that our logs are outputted at the same level as Vagrant core logs.



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
47
48
49
# File 'lib/vagrant-openstack-provider.rb', line 19

def self.init_logging
  # Initialize logging
  level = nil
  begin
    level = Log4r.const_get(ENV['VAGRANT_LOG'].upcase)
  rescue NameError
    # This means that the logging constant wasn't found,
    # which is fine. We just keep `level` as `nil`. But
    # we tell the user.
    begin
      level = Log4r.const_get(ENV['VAGRANT_OPENSTACK_LOG'].upcase)
    rescue NameError
      level = nil
    end
  end

  # Some constants, such as "true" resolve to booleans, so the
  # above error checking doesn't catch it. This will check to make
  # sure that the log level is an integer, as Log4r requires.
  level = nil unless level.is_a?(Integer)

  # Set the logging level
  # logs as long as we have a valid level.
  if level
    logger = Log4r::Logger.new('vagrant_openstack')
    out = Log4r::Outputter.stdout
    out.formatter = Log4r::PatternFormatter.new(pattern: '%d | %5l | %m', date_pattern: '%Y-%m-%d %H:%M')
    logger.outputters = out
    logger.level = level
  end
end

.keystoneObject



34
35
36
# File 'lib/vagrant-openstack-provider/client/openstack.rb', line 34

def self.keystone
  Openstack::KeystoneClient.instance
end

.neutronObject



42
43
44
# File 'lib/vagrant-openstack-provider/client/openstack.rb', line 42

def self.neutron
  Openstack::NeutronClient.instance
end

.novaObject



38
39
40
# File 'lib/vagrant-openstack-provider/client/openstack.rb', line 38

def self.nova
  Openstack::NovaClient.instance
end

.sessionObject



30
31
32
# File 'lib/vagrant-openstack-provider/client/openstack.rb', line 30

def self.session
  Session.instance
end

.source_rootPathname

This returns the path to the source of this plugin.

Returns:

  • (Pathname)


54
55
56
# File 'lib/vagrant-openstack-provider.rb', line 54

def self.source_root
  @source_root ||= Pathname.new(File.expand_path('../../', __FILE__))
end