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.
@@ -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