Module: VagrantPlugins::Rackspace

Defined in:
lib/vagrant-rackspace.rb,
lib/vagrant-rackspace/action.rb,
lib/vagrant-rackspace/config.rb,
lib/vagrant-rackspace/errors.rb,
lib/vagrant-rackspace/plugin.rb,
lib/vagrant-rackspace/version.rb,
lib/vagrant-rackspace/provider.rb,
lib/vagrant-rackspace/command/root.rb,
lib/vagrant-rackspace/command/images.rb,
lib/vagrant-rackspace/command/flavors.rb,
lib/vagrant-rackspace/command/servers.rb,
lib/vagrant-rackspace/command/keypairs.rb,
lib/vagrant-rackspace/command/networks.rb,
lib/vagrant-rackspace/action/is_created.rb,
lib/vagrant-rackspace/action/read_state.rb,
lib/vagrant-rackspace/action/list_images.rb,
lib/vagrant-rackspace/action/create_image.rb,
lib/vagrant-rackspace/action/list_flavors.rb,
lib/vagrant-rackspace/action/list_servers.rb,
lib/vagrant-rackspace/action/sync_folders.rb,
lib/vagrant-rackspace/command/list_images.rb,
lib/vagrant-rackspace/action/create_server.rb,
lib/vagrant-rackspace/action/delete_server.rb,
lib/vagrant-rackspace/action/list_keypairs.rb,
lib/vagrant-rackspace/action/list_networks.rb,
lib/vagrant-rackspace/action/read_ssh_info.rb,
lib/vagrant-rackspace/command/create_image.rb,
lib/vagrant-rackspace/action/connect_rackspace.rb,
lib/vagrant-rackspace/action/message_not_created.rb,
lib/vagrant-rackspace/action/message_already_created.rb

Defined Under Namespace

Modules: Action, Command, Errors Classes: Config, Plugin, Provider

Constant Summary collapse

VERSION =
"0.1.10"

Class Method Summary collapse

Class Method Details

.init_i18nObject

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



12
13
14
15
# File 'lib/vagrant-rackspace.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
# File 'lib/vagrant-rackspace.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.
    level = nil
  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 if !level.is_a?(Integer)

  # Set the logging level on all "vagrant" namespaced
  # logs as long as we have a valid level.
  if level
    logger = Log4r::Logger.new("vagrant_rackspace")
    logger.outputters = Log4r::Outputter.stderr
    logger.level = level
    logger = nil
  end
end

.source_rootPathname

This returns the path to the source of this plugin.

Returns:

  • (Pathname)


49
50
51
# File 'lib/vagrant-rackspace.rb', line 49

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