coral_vagrant 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/Gemfile.lock +21 -15
- data/VERSION +1 -1
- data/bin/coral +2 -0
- data/coral_vagrant.gemspec +19 -10
- data/lib/coral_vagrant.rb +39 -38
- data/lib/coral_vagrant/commands/coral/add.rb +41 -0
- data/lib/coral_vagrant/commands/coral/config.rb +61 -0
- data/lib/coral_vagrant/commands/coral/create.rb +41 -0
- data/lib/coral_vagrant/commands/coral/image.rb +47 -0
- data/lib/coral_vagrant/commands/coral/init.rb +77 -0
- data/lib/coral_vagrant/commands/coral/push.rb +83 -0
- data/lib/coral_vagrant/commands/coral/rm.rb +37 -0
- data/lib/coral_vagrant/commands/coral/run.rb +52 -0
- data/lib/coral_vagrant/commands/coral/send.rb +42 -0
- data/lib/coral_vagrant/commands/coral/update.rb +60 -0
- data/lib/coral_vagrant/commands/coral_base.rb +155 -68
- data/lib/plugin.rb +12 -0
- metadata +109 -167
- data/lib/coral_vagrant/commands/coral_init.rb +0 -78
- data/lib/coral_vagrant/commands/coral_push.rb +0 -84
- data/lib/coral_vagrant/commands/coral_run.rb +0 -53
- data/lib/coral_vagrant/commands/coral_update.rb +0 -61
@@ -1,53 +0,0 @@
|
|
1
|
-
|
2
|
-
module Vagrant
|
3
|
-
module Command
|
4
|
-
module Coral
|
5
|
-
class Run < Base
|
6
|
-
|
7
|
-
#-----------------------------------------------------------------------------
|
8
|
-
# Execution
|
9
|
-
|
10
|
-
def execute
|
11
|
-
options = {}
|
12
|
-
success = true
|
13
|
-
|
14
|
-
opts = OptionParser.new do |opts|
|
15
|
-
opts.banner = "Usage: vagrant cloud run [plan-name]... [-h] ..."
|
16
|
-
opts.separator ""
|
17
|
-
|
18
|
-
options[:repo] = 'config'
|
19
|
-
opts.on("-r", "--repo REPO_DIR", "Local directories of repositories (relative to the Vagrantfile root)") do |r|
|
20
|
-
options[:repo] = r
|
21
|
-
end
|
22
|
-
|
23
|
-
options[:directory] = 'plans'
|
24
|
-
opts.on("-d", "--directory DIR", "Local directory that contains the plan(s) being executed") do |d|
|
25
|
-
options[:directory] = d
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
#---
|
30
|
-
|
31
|
-
plans = parse_options(opts)
|
32
|
-
return if ! plans
|
33
|
-
|
34
|
-
plans.each do |plan_name|
|
35
|
-
@logger.debug("Running plan: #{plan_name}")
|
36
|
-
|
37
|
-
success = ::Coral.create_plan(plan_name, {
|
38
|
-
:home => ::Coral.vagrant,
|
39
|
-
:submodule => options[:repo],
|
40
|
-
:config_file => "#{options[:directory]}/#{plan_name}.json",
|
41
|
-
:logger => @logger,
|
42
|
-
:ui => @env.ui,
|
43
|
-
}).run(options)
|
44
|
-
|
45
|
-
break unless success
|
46
|
-
end
|
47
|
-
|
48
|
-
exit success ? 0 : 1
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
@@ -1,61 +0,0 @@
|
|
1
|
-
|
2
|
-
module Vagrant
|
3
|
-
module Command
|
4
|
-
module Coral
|
5
|
-
class Update < Base
|
6
|
-
|
7
|
-
#-----------------------------------------------------------------------------
|
8
|
-
# Execution
|
9
|
-
|
10
|
-
def execute
|
11
|
-
options = {}
|
12
|
-
success = true
|
13
|
-
|
14
|
-
opts = OptionParser.new do |opts|
|
15
|
-
opts.banner = "Usage: vagrant coral update [server-name]... [-h] ..."
|
16
|
-
opts.separator ""
|
17
|
-
|
18
|
-
options[:min] = 1
|
19
|
-
opts.on("-m", "--min TRIES", "Minimum number of provision runs") do |m|
|
20
|
-
options[:min] = m
|
21
|
-
end
|
22
|
-
|
23
|
-
options[:tries] = 1
|
24
|
-
opts.on("-t", "--tries TRIES", "Number of provision attempts before stopping with an error.") do |t|
|
25
|
-
options[:tries] = t
|
26
|
-
end
|
27
|
-
|
28
|
-
options[:exit] = ''
|
29
|
-
opts.on("-e", "--exit CONDITIONS", "Conditions on which to exit in the format (separated by comma): 'User[git]:ensure:created'") do |e|
|
30
|
-
options[:exit] = e
|
31
|
-
end
|
32
|
-
|
33
|
-
options[:repos] = ''
|
34
|
-
opts.on("-r", "--repos REPO_DIRS,...'", "Local directories of repositories to push (relative to the Vagrantfile root)") do |r|
|
35
|
-
options[:repos] = r
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
options[:auth] = true
|
40
|
-
|
41
|
-
#---
|
42
|
-
|
43
|
-
servers = parse_options(opts)
|
44
|
-
return if ! servers
|
45
|
-
|
46
|
-
with_target_vms(servers) do |vm|
|
47
|
-
@env.ui.info("Starting update run for: #{vm.name}")
|
48
|
-
|
49
|
-
success = ::Coral::Cloud::Server.new({
|
50
|
-
:cloud => ::Coral.vagrant,
|
51
|
-
:machine => vm,
|
52
|
-
:logger => @logger,
|
53
|
-
:ui => @env.ui,
|
54
|
-
}).update(options) if success
|
55
|
-
end
|
56
|
-
exit success ? 0 : 1
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|