Module: VagrantPlugins::Deltacloud

Defined in:
lib/vagrant-deltacloud-provider.rb,
lib/vagrant-deltacloud-provider/utils.rb,
lib/vagrant-deltacloud-provider/action.rb,
lib/vagrant-deltacloud-provider/config.rb,
lib/vagrant-deltacloud-provider/errors.rb,
lib/vagrant-deltacloud-provider/plugin.rb,
lib/vagrant-deltacloud-provider/version.rb,
lib/vagrant-deltacloud-provider/provider.rb,
lib/vagrant-deltacloud-provider/command/main.rb,
lib/vagrant-deltacloud-provider/action/resume.rb,
lib/vagrant-deltacloud-provider/client/domain.rb,
lib/vagrant-deltacloud-provider/command/reset.rb,
lib/vagrant-deltacloud-provider/command/utils.rb,
lib/vagrant-deltacloud-provider/action/message.rb,
lib/vagrant-deltacloud-provider/action/suspend.rb,
lib/vagrant-deltacloud-provider/config_resolver.rb,
lib/vagrant-deltacloud-provider/action/wait_stop.rb,
lib/vagrant-deltacloud-provider/action/read_state.rb,
lib/vagrant-deltacloud-provider/client/deltacloud.rb,
lib/vagrant-deltacloud-provider/client/http_utils.rb,
lib/vagrant-deltacloud-provider/action/stop_server.rb,
lib/vagrant-deltacloud-provider/action/wait_active.rb,
lib/vagrant-deltacloud-provider/command/image_list.rb,
lib/vagrant-deltacloud-provider/action/start_server.rb,
lib/vagrant-deltacloud-provider/action/sync_folders.rb,
lib/vagrant-deltacloud-provider/command/volume_list.rb,
lib/vagrant-deltacloud-provider/action/create_server.rb,
lib/vagrant-deltacloud-provider/action/delete_server.rb,
lib/vagrant-deltacloud-provider/action/read_ssh_info.rb,
lib/vagrant-deltacloud-provider/command/network_list.rb,
lib/vagrant-deltacloud-provider/client/request_logger.rb,
lib/vagrant-deltacloud-provider/command/instance_list.rb,
lib/vagrant-deltacloud-provider/action/abstract_action.rb,
lib/vagrant-deltacloud-provider/action/wait_accessible.rb,
lib/vagrant-deltacloud-provider/command/abstract_command.rb,
lib/vagrant-deltacloud-provider/command/hardware_profile_list.rb

Defined Under Namespace

Modules: Action, Command, Domain, Errors, HttpUtils Classes: Config, ConfigResolver, DeltacloudClient, Plugin, Provider, Utils

Constant Summary collapse

VERSION =
'0.0.9'

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-deltacloud-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-deltacloud-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_DELTACLOUD_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_deltacloud')
    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

.source_rootPathname

This returns the path to the source of this plugin.

Returns:

  • (Pathname)


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

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