Class: Pauper::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/pauper.rb

Defined Under Namespace

Classes: Node

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pauperfile) ⇒ Config

Returns a new instance of Config.



658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
# File 'lib/pauper.rb', line 658

def initialize(pauperfile)
  @config = {
    :nodes => [],
    :ssh_user => 'dev',
    :ssh_password => 'password',
    :vm_path => Fusion::DEFAULT_VMPATH,
    :run_list => [],
    :shares => [],
    :subnet => '172.16.254',
    :chef_options => {},
    :dev_domain => nil,
    :chef_download_url => {
      :lucid => 'https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/10.04/x86_64',
      :precise => 'https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/12.04/x86_64',
    },
    :chef_deb_name => {
      :lucid => 'chef_11.0.0-1.ubuntu.10.04_amd64.deb',
      :precise => 'chef_11.10.4-1.ubuntu.12.04_amd64.deb',
    },
  }
  if File.exists? pauperfile
    pauperpath = File.dirname(pauperfile)
    instance_eval File.read(pauperfile)
  else
    abort "!! Could not find Pauperfile at #{pauperfile} !!" 
  end
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



656
657
658
# File 'lib/pauper.rb', line 656

def config
  @config
end

Instance Method Details

#bootstrap_ssh_key(key_path) ⇒ Object



726
727
728
# File 'lib/pauper.rb', line 726

def bootstrap_ssh_key(key_path)
  @config[:bootstrap_ssh_key] = key_path
end

#chef_deb_name(name, release = 'lucid') ⇒ Object



738
739
740
# File 'lib/pauper.rb', line 738

def chef_deb_name(name, release='lucid')
  @config[:chef_deb_name][Pauper.grok_release(release)] = name
end

#chef_download_url(url, release = 'lucid') ⇒ Object



734
735
736
# File 'lib/pauper.rb', line 734

def chef_download_url(url, release='lucid')
  @config[:chef_download_url][Pauper.grok_release(release)] = url
end

#chef_environment(env) ⇒ Object



750
751
752
# File 'lib/pauper.rb', line 750

def chef_environment(env)
  @config[:chef_environment] = env
end

#chef_options(opts) ⇒ Object



754
755
756
# File 'lib/pauper.rb', line 754

def chef_options(opts)
  @config[:chef_options] = opts
end

#chef_server_url(url) ⇒ Object



730
731
732
# File 'lib/pauper.rb', line 730

def chef_server_url(url)
  @config[:chef_server_url] = url
end

#cpus(count) ⇒ Object



722
723
724
# File 'lib/pauper.rb', line 722

def cpus(count)
  @config[:default_cpus] = count
end

#default_run_list(list) ⇒ Object



758
759
760
# File 'lib/pauper.rb', line 758

def default_run_list(list)
  @config[:default_run_list] = list
end

#dev_domain(dev_domain) ⇒ Object



698
699
700
# File 'lib/pauper.rb', line 698

def dev_domain(dev_domain)
  @config[:dev_domain] = dev_domain
end

#get_node(node_name) ⇒ Object



686
687
688
# File 'lib/pauper.rb', line 686

def get_node(node_name)
  @config[:nodes].detect { |n| n.name == node_name }
end

#node(name, &block) ⇒ Object



714
715
716
# File 'lib/pauper.rb', line 714

def node(name, &block)
  @config[:nodes] << Node.new(name, name, &block)
end

#node_suffix(suffix) ⇒ Object



766
767
768
# File 'lib/pauper.rb', line 766

def node_suffix(suffix)
  @config[:node_suffix] = suffix
end

#ram(megabytes) ⇒ Object



718
719
720
# File 'lib/pauper.rb', line 718

def ram(megabytes)
  @config[:default_ram] = megabytes
end

#share(share_name, guest_path, host_path, options = {}) ⇒ Object



762
763
764
# File 'lib/pauper.rb', line 762

def share(share_name, guest_path, host_path, options={})
  @config[:shares] << [share_name, guest_path, host_path, options]
end

#ssh_password(pass) ⇒ Object



694
695
696
# File 'lib/pauper.rb', line 694

def ssh_password(pass)
  @config[:ssh_password] = pass
end

#ssh_user(user) ⇒ Object



690
691
692
# File 'lib/pauper.rb', line 690

def ssh_user(user)
  @config[:ssh_user] = user
end

#subnet(net) ⇒ Object



702
703
704
# File 'lib/pauper.rb', line 702

def subnet(net)
  @config[:subnet] = net
end

#validation_client_name(name) ⇒ Object



746
747
748
# File 'lib/pauper.rb', line 746

def validation_client_name(name)
  @config[:validation_client_name] = name
end

#validation_key_path(path) ⇒ Object



742
743
744
# File 'lib/pauper.rb', line 742

def validation_key_path(path)
  @config[:validation_key_path] = File.expand_path(path)
end

#vm_path(path) ⇒ Object



706
707
708
# File 'lib/pauper.rb', line 706

def vm_path(path)
  @config[:vm_path] = File.expand_path(path)
end

#vmx(vmx_file) ⇒ Object



710
711
712
# File 'lib/pauper.rb', line 710

def vmx(vmx_file)
  @config[:vmx] = File.expand_path(vmx_file)
end