vagrant-yaybu 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/Rakefile +1 -0
- data/lib/vagrant-yaybu/provisioner.rb +116 -0
- data/lib/vagrant-yaybu/version.rb +5 -0
- data/lib/vagrant-yaybu.rb +3 -0
- data/lib/vagrant_init.rb +7 -0
- data/vagrant-yaybu.gemspec +24 -0
- metadata +75 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,116 @@
|
|
1
|
+
# Copyright 2011 Isotoma Limited
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
require 'yaml'
|
16
|
+
|
17
|
+
$deploy_script = <<-EOS
|
18
|
+
#! /usr/bin/env python
|
19
|
+
|
20
|
+
import sys, StringIO
|
21
|
+
from yay.config import Config
|
22
|
+
from yaybu.core.remote import RemoteRunner
|
23
|
+
from yaybu.core.runcontext import RunContext
|
24
|
+
|
25
|
+
raw_config = StringIO.StringIO("""
|
26
|
+
<%= yay %>
|
27
|
+
""")
|
28
|
+
|
29
|
+
config = Config()
|
30
|
+
config.load(raw_config)
|
31
|
+
|
32
|
+
class opts:
|
33
|
+
log_level = "info"
|
34
|
+
logfile = "-"
|
35
|
+
host = "<%= ssh_user %>@<%= ssh_host %>:<%= ssh_port %>"
|
36
|
+
user = "root"
|
37
|
+
ypath = []
|
38
|
+
simulate = False
|
39
|
+
verbose = False
|
40
|
+
resume = True
|
41
|
+
no_resume = False
|
42
|
+
env_passthrough = []
|
43
|
+
|
44
|
+
ctx = RunContext(None, opts)
|
45
|
+
ctx.set_config(config)
|
46
|
+
|
47
|
+
r = RemoteRunner()
|
48
|
+
r.set_interactive(False)
|
49
|
+
r.set_identity_file("<%= private_key_path %>")
|
50
|
+
r.set_missing_host_key_policy("no")
|
51
|
+
r.load_host_keys("/dev/null")
|
52
|
+
rv = r.run(ctx)
|
53
|
+
sys.exit(rv)
|
54
|
+
|
55
|
+
EOS
|
56
|
+
|
57
|
+
module Vagrant
|
58
|
+
module Provisioners
|
59
|
+
class YaybuError < Vagrant::Errors::VagrantError
|
60
|
+
error_namespace("vagrant.provisioners.yaybu")
|
61
|
+
end
|
62
|
+
|
63
|
+
class YaybuProvisioner < Base
|
64
|
+
register :yaybu
|
65
|
+
|
66
|
+
class Config < Vagrant::Config::Base
|
67
|
+
attr_accessor :yay
|
68
|
+
attr_accessor :python
|
69
|
+
|
70
|
+
def initialize
|
71
|
+
@yay = ""
|
72
|
+
@python = "python"
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def bootstrap
|
77
|
+
vm.ssh.execute do |ssh|
|
78
|
+
begin
|
79
|
+
ssh.sudo!("which yaybu", :error_class => YaybuError, :_key => :yaybu_not_detected, :binary => "yaybu")
|
80
|
+
rescue
|
81
|
+
env.ui.info "Yaybu not found so attmpting to install it"
|
82
|
+
ssh.sudo!("apt-get update")
|
83
|
+
ssh.sudo!("apt-get install python-setuptools -y")
|
84
|
+
ssh.sudo!("easy_install Yaybu")
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def prepare
|
90
|
+
end
|
91
|
+
|
92
|
+
def provision!
|
93
|
+
bootstrap
|
94
|
+
|
95
|
+
deployment_script = TemplateRenderer.render_string($deploy_script, {
|
96
|
+
:ssh_host => vm.env.config.ssh.host,
|
97
|
+
:ssh_user => vm.env.config.ssh.username,
|
98
|
+
:ssh_port => vm.ssh.port,
|
99
|
+
:private_key_path => vm.env.config.ssh.private_key_path,
|
100
|
+
:yay => config.yay,
|
101
|
+
})
|
102
|
+
|
103
|
+
IO.popen("#{config.python} -", "r+") do |io|
|
104
|
+
io.write(deployment_script)
|
105
|
+
io.close_write
|
106
|
+
|
107
|
+
while line = io.gets do
|
108
|
+
env.ui.info("#{line}")
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
data/lib/vagrant_init.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "vagrant-yaybu/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "vagrant-yaybu"
|
7
|
+
s.version = Vagrant::Yaybu::VERSION
|
8
|
+
s.authors = ["John Carr"]
|
9
|
+
s.email = ["john.carr@isotoma.com"]
|
10
|
+
s.homepage = ""
|
11
|
+
s.summary = %q{Teach Vagrant about Yaybu}
|
12
|
+
s.description = %q{This plugin adds a Yaybu 'push' provisioner to Vagrant}
|
13
|
+
|
14
|
+
s.rubyforge_project = "vagrant-yaybu"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
# specify any dependencies here; for example:
|
22
|
+
# s.add_development_dependency "rspec"
|
23
|
+
# s.add_runtime_dependency "rest-client"
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vagrant-yaybu
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- John Carr
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-11-07 00:00:00 +00:00
|
19
|
+
default_executable:
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description: This plugin adds a Yaybu 'push' provisioner to Vagrant
|
23
|
+
email:
|
24
|
+
- john.carr@isotoma.com
|
25
|
+
executables: []
|
26
|
+
|
27
|
+
extensions: []
|
28
|
+
|
29
|
+
extra_rdoc_files: []
|
30
|
+
|
31
|
+
files:
|
32
|
+
- .gitignore
|
33
|
+
- Gemfile
|
34
|
+
- Rakefile
|
35
|
+
- lib/vagrant-yaybu.rb
|
36
|
+
- lib/vagrant-yaybu/provisioner.rb
|
37
|
+
- lib/vagrant-yaybu/version.rb
|
38
|
+
- lib/vagrant_init.rb
|
39
|
+
- vagrant-yaybu.gemspec
|
40
|
+
has_rdoc: true
|
41
|
+
homepage: ""
|
42
|
+
licenses: []
|
43
|
+
|
44
|
+
post_install_message:
|
45
|
+
rdoc_options: []
|
46
|
+
|
47
|
+
require_paths:
|
48
|
+
- lib
|
49
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
hash: 3
|
55
|
+
segments:
|
56
|
+
- 0
|
57
|
+
version: "0"
|
58
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
hash: 3
|
64
|
+
segments:
|
65
|
+
- 0
|
66
|
+
version: "0"
|
67
|
+
requirements: []
|
68
|
+
|
69
|
+
rubyforge_project: vagrant-yaybu
|
70
|
+
rubygems_version: 1.3.7
|
71
|
+
signing_key:
|
72
|
+
specification_version: 3
|
73
|
+
summary: Teach Vagrant about Yaybu
|
74
|
+
test_files: []
|
75
|
+
|