Class: Vagrant::Provisioners::YaybuProvisioner
- Inherits:
-
Base
- Object
- Base
- Vagrant::Provisioners::YaybuProvisioner
- Defined in:
- lib/vagrant-yaybu/provisioner.rb
Defined Under Namespace
Classes: Config
Instance Method Summary collapse
- #bootstrap ⇒ Object
- #prepare ⇒ Object
- #provision! ⇒ Object
- #verify_import(mod) ⇒ Object
- #verify_local_binary(binary) ⇒ Object
Instance Method Details
#bootstrap ⇒ Object
94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/vagrant-yaybu/provisioner.rb', line 94 def bootstrap vm.ssh.execute do |ssh| begin ssh.sudo!("which yaybu", :error_class => YaybuError, :_key => :yaybu_not_detected, :binary => "yaybu") rescue env.ui.info "Yaybu not found so attmpting to install it" ssh.sudo!("apt-get update") ssh.sudo!("apt-get install python-setuptools -y") ssh.sudo!("easy_install Yaybu") end end end |
#prepare ⇒ Object
107 108 |
# File 'lib/vagrant-yaybu/provisioner.rb', line 107 def prepare end |
#provision! ⇒ Object
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/vagrant-yaybu/provisioner.rb', line 122 def provision! verify_import "yaybu" verify_import "yay" verify_local_binary "ssh" bootstrap deployment_script = TemplateRenderer.render_string($deploy_script, { :ssh_host => vm.env.config.ssh.host, :ssh_user => vm.env.config.ssh.username, :ssh_port => vm.ssh.port, :private_key_path => vm.env.config.ssh.private_key_path, :yay => config.yay, :searchpath => config.searchpath, :includes => config.include, }) IO.popen("#{config.python} -c 'import sys; exec(sys.stdin.read())'", "r+") do |io| io.write(deployment_script) io.close_write while line = io.gets do env.ui.info("#{line}") end end end |
#verify_import(mod) ⇒ Object
110 111 112 113 114 |
# File 'lib/vagrant-yaybu/provisioner.rb', line 110 def verify_import(mod) if not system("#{config.python}", "-c", "import #{mod}") then raise YaybuError.new "Module #{mod} not found" end end |
#verify_local_binary(binary) ⇒ Object
116 117 118 119 120 |
# File 'lib/vagrant-yaybu/provisioner.rb', line 116 def verify_local_binary(binary) if not system("which #{binary}") then raise YaybuError.new "Local binary #{binary} not found" end end |