Class: PoolParty::Plugin::ConvenienceHelpers

Inherits:
PoolParty::Plugin show all
Defined in:
lib/extensions/convenience_helpers.rb

Instance Method Summary collapse

Instance Method Details

#add_aliasesObject



64
65
66
67
68
69
70
71
# File 'lib/extensions/convenience_helpers.rb', line 64

def add_aliases
  has_bash_alias :name => "inspect-poolparty-recipes", :value => "vi /var/poolparty/dr_configure/chef/cookbooks/poolparty/recipes/default.rb"
  has_bash_alias :name => "cd-cookbooks", :value => "pushd /var/poolparty/dr_configure/chef/cookbooks/poolparty"

  %w{instance-id local-hostname local-ipv4 public-hostname public-ipv4 security-groups}.each do |metaalias|
    has_bash_alias :name => metaalias, :value => "curl http://169.254.169.254/latest/meta-data/#{metaalias}"
  end
end

#add_binariesObject



73
74
75
76
77
# File 'lib/extensions/convenience_helpers.rb', line 73

def add_binaries
  has_exec "wget http://gist.github.com/raw/131294/0622454b2cc2f787c04d20ab3d47e888e31edcd4/gistfile1 -O /usr/bin/xtail && chmod +x /usr/bin/xtail", 
    :not_if => "test -e /usr/bin/xtail"
  has_exec "curl http://timkay.com/aws/aws -o /usr/bin/aws", :not_if => "test -e /usr/bin/aws"
end

#add_packagesObject



50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/extensions/convenience_helpers.rb', line 50

def add_packages
  has_package "curl"
  has_package "tree"
  has_package "screen"

  case cloud.os
  when "centos"
    has_package "ruby-irb"
  else
    has_package "irb"
    has_package "vim-nox"
  end
end

#add_profile_updatesObject



79
80
81
82
83
# File 'lib/extensions/convenience_helpers.rb', line 79

def add_profile_updates
  has_exec %Q{echo \\"export PS1='\\\\u@\\\\h \\\\A \\\\w (#{cloud_name}) $ '\\" >> /root/.profile}, :not_if => "grep PS1 /root/.profile | grep #{cloud_name}"
  # bind '"\e[A":history-search-backward'
  # bind '"\e[B":history-search-forward'
end

#before_load(o = {}, &block) ⇒ Object



43
44
45
46
47
48
# File 'lib/extensions/convenience_helpers.rb', line 43

def before_load(o={}, &block)
  add_packages
  add_aliases
  add_binaries
  add_profile_updates
end