Class: Souffle::Provider::Vagrant

Inherits:
Base
  • Object
show all
Defined in:
lib/souffle/provider/vagrant.rb

Overview

The Vagrant souffle provider.

Instance Attribute Summary collapse

Attributes inherited from Base

#system

Instance Method Summary collapse

Methods inherited from Base

#boot, #cookbook_paths, #create_cookbooks_tarball, #create_ssh_dir_if_missing, #generate_chef_json, #name, #role_paths, #rsync_file, #ssh_block, #ssh_key, #ssh_key_exists?, #ssh_key_path, update_status, #wait_for_boot

Constructor Details

#initializeVagrant

Setup the internal Vagrant configuration and object.



9
10
11
12
13
14
# File 'lib/souffle/provider/vagrant.rb', line 9

def initialize
  super()
  @vagrant_dir = @system.try_opt(:vagrant_dir)
  create_new_vm_group unless current_folder_has_souffle_config?
  generate_vagrant_config
end

Instance Attribute Details

#vagrant_dirObject (readonly)

Returns the value of attribute vagrant_dir.



6
7
8
# File 'lib/souffle/provider/vagrant.rb', line 6

def vagrant_dir
  @vagrant_dir
end

Instance Method Details

#create_new_vm_groupObject

Creates a new virtualmachine group.



41
42
# File 'lib/souffle/provider/vagrant.rb', line 41

def create_new_vm_group
end

#create_node(node, tag = nil) ⇒ Object

Takes a node definition and begins the provisioning process.

Parameters:

  • node (Souffle::Node)

    The node to instantiate.

  • tag (String) (defaults to: nil)

    The tag to use for the node.



27
28
# File 'lib/souffle/provider/vagrant.rb', line 27

def create_node(node, tag=nil)
end

#create_raidObject

Noop.



31
# File 'lib/souffle/provider/vagrant.rb', line 31

def create_raid; end

#create_system(system, tag_prefix = nil) ⇒ Object

Creates a system using vagrant as the provider.

Parameters:

  • system (Souffle::System)

    The system to instantiate.

  • tag_prefix (String) (defaults to: nil)

    The tag prefix to use for the system.



20
21
# File 'lib/souffle/provider/vagrant.rb', line 20

def create_system(system, tag_prefix=nil)
end

#current_folder_has_souffle_config?Boolean

Checks if the current folder has the souffle configuration object.

Returns:

  • (Boolean)

    Whether or not we’re in a souffle Vagrant project.



36
37
38
# File 'lib/souffle/provider/vagrant.rb', line 36

def current_folder_has_souffle_config?
  File.exists? "#{Dir.pwd}/souffle.json"
end

#generate_vagrant_configObject

Generates the multi-vm configuration.



45
46
47
48
49
50
51
# File 'lib/souffle/provider/vagrant.rb', line 45

def generate_vagrant_config
  template = Souffle::Template.new('Vagrantfile.erb')
  temp_binding = OpenStruct.new
  temp_binding.version = Souffle::VERSION
  
  template.render(temp_binding)
end