corl 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/VERSION +1 -1
- data/bootstrap/os/ubuntu/06_puppet.sh +1 -1
- data/corl.gemspec +171 -3
- data/lib/CORL/builder/identity.rb +6 -3
- data/lib/CORL/builder/package.rb +3 -3
- data/lib/CORL/configuration/file.rb +21 -7
- data/lib/CORL/machine/vagrant.rb +3 -3
- data/lib/CORL/node/vagrant.rb +2 -5
- data/lib/CORL/provisioner/puppetnode.rb +8 -8
- data/lib/core/facade.rb +7 -3
- data/lib/core/mixin/action/keypair.rb +3 -3
- data/lib/core/mixin/action/registration.rb +31 -0
- data/lib/core/mixin/lookup.rb +50 -6
- data/lib/core/mixin/machine/ssh.rb +4 -4
- data/lib/core/plugin/cloud_action.rb +8 -1
- data/lib/core/plugin/configuration.rb +6 -7
- data/lib/core/plugin/fog_node.rb +7 -0
- data/lib/core/plugin/network.rb +31 -0
- data/lib/core/plugin/node.rb +182 -117
- data/lib/core/vagrant/provisioner/provisioner.rb +1 -1
- data/lib/nucleon/action/cloud/config.rb +259 -0
- data/lib/nucleon/action/cloud/images.rb +1 -1
- data/lib/nucleon/action/cloud/inspect.rb +11 -2
- data/lib/nucleon/action/cloud/machines.rb +1 -1
- data/lib/nucleon/action/cloud/regions.rb +1 -1
- data/lib/nucleon/action/cloud/settings.rb +185 -0
- data/lib/nucleon/action/node/IP.rb +1 -1
- data/lib/nucleon/action/node/bootstrap.rb +1 -1
- data/lib/nucleon/action/node/cache.rb +133 -0
- data/lib/nucleon/action/node/fact.rb +119 -0
- data/lib/nucleon/action/node/facts.rb +16 -16
- data/lib/nucleon/action/node/group.rb +115 -0
- data/lib/nucleon/action/node/groups.rb +33 -0
- data/lib/nucleon/action/node/identity.rb +75 -0
- data/lib/nucleon/action/node/lookup.rb +20 -7
- data/lib/nucleon/action/node/seed.rb +6 -6
- data/lib/nucleon/action/node/status.rb +76 -0
- data/lib/nucleon/action/plugin/create.rb +169 -0
- data/lib/nucleon/action/plugin/list.rb +69 -0
- data/lib/nucleon/action/plugin/template/nucleon.action.erb +56 -0
- data/lib/nucleon/action/plugins.rb +14 -0
- data/locales/en.yml +3 -0
- data/rdoc/site/0.5.0/CORL/Build.html +757 -0
- data/rdoc/site/0.5.0/CORL/Builder/Identity.html +569 -0
- data/rdoc/site/0.5.0/CORL/Builder/Package.html +576 -0
- data/rdoc/site/0.5.0/CORL/Builder.html +360 -0
- data/rdoc/site/0.5.0/CORL/Configuration/File.html +1148 -0
- data/rdoc/site/0.5.0/CORL/Configuration.html +359 -0
- data/rdoc/site/0.5.0/CORL/Errors.html +359 -0
- data/rdoc/site/0.5.0/CORL/Facade.html +899 -0
- data/rdoc/site/0.5.0/CORL/Machine/AWS.html +753 -0
- data/rdoc/site/0.5.0/CORL/Machine/Fog.html +1289 -0
- data/rdoc/site/0.5.0/CORL/Machine/Physical.html +1059 -0
- data/rdoc/site/0.5.0/CORL/Machine/Rackspace.html +534 -0
- data/rdoc/site/0.5.0/CORL/Machine/Vagrant.html +1320 -0
- data/rdoc/site/0.5.0/CORL/Machine.html +363 -0
- data/rdoc/site/0.5.0/CORL/Mixin/Action/Keypair.html +592 -0
- data/rdoc/site/0.5.0/CORL/Mixin/Action.html +359 -0
- data/rdoc/site/0.5.0/CORL/Mixin/Builder/Global.html +604 -0
- data/rdoc/site/0.5.0/CORL/Mixin/Builder/Instance.html +696 -0
- data/rdoc/site/0.5.0/CORL/Mixin/Builder.html +359 -0
- data/rdoc/site/0.5.0/CORL/Mixin/Lookup.html +1139 -0
- data/rdoc/site/0.5.0/CORL/Mixin/Machine/SSH.html +675 -0
- data/rdoc/site/0.5.0/CORL/Mixin/Machine.html +359 -0
- data/rdoc/site/0.5.0/CORL/Mixin/Macro/NetworkSettings.html +484 -0
- data/rdoc/site/0.5.0/CORL/Mixin/Macro.html +359 -0
- data/rdoc/site/0.5.0/CORL/Mixin.html +363 -0
- data/rdoc/site/0.5.0/CORL/Network/CORL.html +411 -0
- data/rdoc/site/0.5.0/CORL/Network.html +359 -0
- data/rdoc/site/0.5.0/CORL/Node/AWS.html +736 -0
- data/rdoc/site/0.5.0/CORL/Node/Fog.html +1212 -0
- data/rdoc/site/0.5.0/CORL/Node/Local.html +444 -0
- data/rdoc/site/0.5.0/CORL/Node/Rackspace.html +729 -0
- data/rdoc/site/0.5.0/CORL/Node/Vagrant.html +1476 -0
- data/rdoc/site/0.5.0/CORL/Node.html +363 -0
- data/rdoc/site/0.5.0/CORL/Plugin/Builder.html +500 -0
- data/rdoc/site/0.5.0/CORL/Plugin/Configuration.html +1271 -0
- data/rdoc/site/0.5.0/CORL/Plugin/Machine.html +1299 -0
- data/rdoc/site/0.5.0/CORL/Plugin/Network.html +1580 -0
- data/rdoc/site/0.5.0/CORL/Plugin/Node.html +4041 -0
- data/rdoc/site/0.5.0/CORL/Plugin/Provisioner.html +1115 -0
- data/rdoc/site/0.5.0/CORL/Plugin.html +649 -0
- data/rdoc/site/0.5.0/CORL/Provisioner/Puppetnode.html +1177 -0
- data/rdoc/site/0.5.0/CORL/Provisioner.html +359 -0
- data/rdoc/site/0.5.0/CORL/Util/Puppet/Resource.html +1058 -0
- data/rdoc/site/0.5.0/CORL/Util/Puppet/ResourceGroup.html +940 -0
- data/rdoc/site/0.5.0/CORL/Util/Puppet.html +1107 -0
- data/rdoc/site/0.5.0/CORL/Util.html +361 -0
- data/rdoc/site/0.5.0/CORL/Vagrant/Config.html +943 -0
- data/rdoc/site/0.5.0/CORL/Vagrant.html +438 -0
- data/rdoc/site/0.5.0/CORL.html +471 -0
- data/rdoc/site/0.5.0/Fog/Compute/AWS/Server.html +443 -0
- data/rdoc/site/0.5.0/Fog/Compute/AWS.html +365 -0
- data/rdoc/site/0.5.0/Fog/Compute/RackspaceV2/Server.html +428 -0
- data/rdoc/site/0.5.0/Fog/Compute/RackspaceV2.html +365 -0
- data/rdoc/site/0.5.0/Fog/Compute.html +360 -0
- data/rdoc/site/0.5.0/Fog.html +360 -0
- data/rdoc/site/0.5.0/Hiera/Backend.html +442 -0
- data/rdoc/site/0.5.0/Hiera/Corl_logger.html +469 -0
- data/rdoc/site/0.5.0/Hiera.html +366 -0
- data/rdoc/site/0.5.0/Nucleon/Action/Cloud/Create.html +538 -0
- data/rdoc/site/0.5.0/Nucleon/Action/Cloud/Hiera.html +566 -0
- data/rdoc/site/0.5.0/Nucleon/Action/Cloud/Images.html +572 -0
- data/rdoc/site/0.5.0/Nucleon/Action/Cloud/Inspect.html +524 -0
- data/rdoc/site/0.5.0/Nucleon/Action/Cloud/Machines.html +567 -0
- data/rdoc/site/0.5.0/Nucleon/Action/Cloud/Regions.html +567 -0
- data/rdoc/site/0.5.0/Nucleon/Action/Cloud/Vagrantfile.html +515 -0
- data/rdoc/site/0.5.0/Nucleon/Action/Cloud.html +365 -0
- data/rdoc/site/0.5.0/Nucleon/Action/Node/Authorize.html +543 -0
- data/rdoc/site/0.5.0/Nucleon/Action/Node/Bootstrap.html +604 -0
- data/rdoc/site/0.5.0/Nucleon/Action/Node/Build.html +526 -0
- data/rdoc/site/0.5.0/Nucleon/Action/Node/Destroy.html +573 -0
- data/rdoc/site/0.5.0/Nucleon/Action/Node/Exec.html +530 -0
- data/rdoc/site/0.5.0/Nucleon/Action/Node/Facts.html +456 -0
- data/rdoc/site/0.5.0/Nucleon/Action/Node/IP.html +453 -0
- data/rdoc/site/0.5.0/Nucleon/Action/Node/Image.html +573 -0
- data/rdoc/site/0.5.0/Nucleon/Action/Node/Keypair.html +572 -0
- data/rdoc/site/0.5.0/Nucleon/Action/Node/Lookup.html +532 -0
- data/rdoc/site/0.5.0/Nucleon/Action/Node/Provision.html +553 -0
- data/rdoc/site/0.5.0/Nucleon/Action/Node/Reboot.html +573 -0
- data/rdoc/site/0.5.0/Nucleon/Action/Node/Revoke.html +541 -0
- data/rdoc/site/0.5.0/Nucleon/Action/Node/SSH.html +583 -0
- data/rdoc/site/0.5.0/Nucleon/Action/Node/Seed.html +602 -0
- data/rdoc/site/0.5.0/Nucleon/Action/Node/Spawn.html +675 -0
- data/rdoc/site/0.5.0/Nucleon/Action/Node/Start.html +573 -0
- data/rdoc/site/0.5.0/Nucleon/Action/Node/Stop.html +573 -0
- data/rdoc/site/0.5.0/Nucleon/Action/Node.html +376 -0
- data/rdoc/site/0.5.0/Nucleon/Action.html +383 -0
- data/rdoc/site/0.5.0/Nucleon/Config.html +377 -0
- data/rdoc/site/0.5.0/Nucleon/Event/Puppet.html +693 -0
- data/rdoc/site/0.5.0/Nucleon/Event.html +359 -0
- data/rdoc/site/0.5.0/Nucleon/Plugin/Base.html +365 -0
- data/rdoc/site/0.5.0/Nucleon/Plugin/CloudAction.html +838 -0
- data/rdoc/site/0.5.0/Nucleon/Plugin.html +360 -0
- data/rdoc/site/0.5.0/Nucleon/Template/Environment.html +548 -0
- data/rdoc/site/0.5.0/Nucleon/Template.html +359 -0
- data/rdoc/site/0.5.0/Nucleon.html +387 -0
- data/rdoc/site/0.5.0/Object.html +378 -0
- data/rdoc/site/0.5.0/Puppet/DataBinding/Corl.html +365 -0
- data/rdoc/site/0.5.0/Puppet/DataBinding.html +358 -0
- data/rdoc/site/0.5.0/Puppet/Indirector/Corl.html +477 -0
- data/rdoc/site/0.5.0/Puppet/Indirector.html +358 -0
- data/rdoc/site/0.5.0/Puppet/Parser/Functions.html +500 -0
- data/rdoc/site/0.5.0/Puppet/Parser.html +358 -0
- data/rdoc/site/0.5.0/Puppet.html +358 -0
- data/rdoc/site/0.5.0/README_rdoc.html +360 -0
- data/rdoc/site/0.5.0/Vagrant/Config/Loader.html +419 -0
- data/rdoc/site/0.5.0/Vagrant/Config.html +359 -0
- data/rdoc/site/0.5.0/Vagrant/Vagrantfile.html +412 -0
- data/rdoc/site/0.5.0/Vagrant.html +366 -0
- data/rdoc/site/0.5.0/VagrantPlugins/CORL/Action/DeleteCache.html +422 -0
- data/rdoc/site/0.5.0/VagrantPlugins/CORL/Action/InitKeys.html +428 -0
- data/rdoc/site/0.5.0/VagrantPlugins/CORL/Action/LinkNetwork.html +426 -0
- data/rdoc/site/0.5.0/VagrantPlugins/CORL/Action.html +361 -0
- data/rdoc/site/0.5.0/VagrantPlugins/CORL/BaseAction.html +511 -0
- data/rdoc/site/0.5.0/VagrantPlugins/CORL/Command/Launcher.html +553 -0
- data/rdoc/site/0.5.0/VagrantPlugins/CORL/Command.html +359 -0
- data/rdoc/site/0.5.0/VagrantPlugins/CORL/Config/CORL.html +752 -0
- data/rdoc/site/0.5.0/VagrantPlugins/CORL/Config.html +359 -0
- data/rdoc/site/0.5.0/VagrantPlugins/CORL/Plugin.html +365 -0
- data/rdoc/site/0.5.0/VagrantPlugins/CORL/Provisioner/CORL.html +556 -0
- data/rdoc/site/0.5.0/VagrantPlugins/CORL/Provisioner.html +359 -0
- data/rdoc/site/0.5.0/VagrantPlugins/CORL.html +366 -0
- data/rdoc/site/0.5.0/VagrantPlugins.html +366 -0
- data/rdoc/site/0.5.0/created.rid +103 -0
- data/rdoc/site/0.5.0/images/add.png +0 -0
- data/rdoc/site/0.5.0/images/brick.png +0 -0
- data/rdoc/site/0.5.0/images/brick_link.png +0 -0
- data/rdoc/site/0.5.0/images/bug.png +0 -0
- data/rdoc/site/0.5.0/images/bullet_black.png +0 -0
- data/rdoc/site/0.5.0/images/bullet_toggle_minus.png +0 -0
- data/rdoc/site/0.5.0/images/bullet_toggle_plus.png +0 -0
- data/rdoc/site/0.5.0/images/date.png +0 -0
- data/rdoc/site/0.5.0/images/delete.png +0 -0
- data/rdoc/site/0.5.0/images/find.png +0 -0
- data/rdoc/site/0.5.0/images/loadingAnimation.gif +0 -0
- data/rdoc/site/0.5.0/images/macFFBgHack.png +0 -0
- data/rdoc/site/0.5.0/images/package.png +0 -0
- data/rdoc/site/0.5.0/images/page_green.png +0 -0
- data/rdoc/site/0.5.0/images/page_white_text.png +0 -0
- data/rdoc/site/0.5.0/images/page_white_width.png +0 -0
- data/rdoc/site/0.5.0/images/plugin.png +0 -0
- data/rdoc/site/0.5.0/images/ruby.png +0 -0
- data/rdoc/site/0.5.0/images/tag_blue.png +0 -0
- data/rdoc/site/0.5.0/images/tag_green.png +0 -0
- data/rdoc/site/0.5.0/images/transparent.png +0 -0
- data/rdoc/site/0.5.0/images/wrench.png +0 -0
- data/rdoc/site/0.5.0/images/wrench_orange.png +0 -0
- data/rdoc/site/0.5.0/images/zoom.png +0 -0
- data/rdoc/site/0.5.0/index.html +359 -0
- data/rdoc/site/0.5.0/js/darkfish.js +155 -0
- data/rdoc/site/0.5.0/js/jquery.js +18 -0
- data/rdoc/site/0.5.0/js/navigation.js +142 -0
- data/rdoc/site/0.5.0/js/search.js +94 -0
- data/rdoc/site/0.5.0/js/search_index.js +1 -0
- data/rdoc/site/0.5.0/js/searcher.js +228 -0
- data/rdoc/site/0.5.0/rdoc.css +543 -0
- data/rdoc/site/0.5.0/table_of_contents.html +1797 -0
- metadata +171 -3
- data/lib/nucleon/action/cloud/hiera.rb +0 -61
@@ -0,0 +1,119 @@
|
|
1
|
+
|
2
|
+
module Nucleon
|
3
|
+
module Action
|
4
|
+
module Node
|
5
|
+
class Fact < CORL.plugin_class(:nucleon, :cloud_action)
|
6
|
+
|
7
|
+
include Mixin::Action::Registration
|
8
|
+
|
9
|
+
#-----------------------------------------------------------------------------
|
10
|
+
# Info
|
11
|
+
|
12
|
+
def self.describe(action = :fact, weight = 570)
|
13
|
+
super(:node, action, weight)
|
14
|
+
end
|
15
|
+
|
16
|
+
#-----------------------------------------------------------------------------
|
17
|
+
# Settings
|
18
|
+
|
19
|
+
def configure(aggregate = false)
|
20
|
+
super() do
|
21
|
+
codes :fact_save_failed
|
22
|
+
|
23
|
+
unless aggregate
|
24
|
+
register_str :name, nil
|
25
|
+
register_str :value
|
26
|
+
|
27
|
+
register_bool :delete
|
28
|
+
|
29
|
+
register_translator :input_format
|
30
|
+
end
|
31
|
+
|
32
|
+
register_translator :format, :json
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
#---
|
37
|
+
|
38
|
+
def arguments
|
39
|
+
[ :name, :value ]
|
40
|
+
end
|
41
|
+
|
42
|
+
#-----------------------------------------------------------------------------
|
43
|
+
# Operations
|
44
|
+
|
45
|
+
def execute
|
46
|
+
super do |node, network|
|
47
|
+
ensure_node(node) do
|
48
|
+
if ! settings[:name] || settings[:name].empty?
|
49
|
+
render_node_facts(node)
|
50
|
+
else
|
51
|
+
if settings.delete(:delete, false)
|
52
|
+
delete_node_fact(node, settings[:name], sanitize_remote(network, settings[:net_remote]))
|
53
|
+
elsif settings[:value] && ! settings[:value].empty?
|
54
|
+
set_node_fact(node, settings[:name], settings[:value], sanitize_remote(network, settings[:net_remote]))
|
55
|
+
else
|
56
|
+
render_node_fact(node, settings[:name])
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
#-----------------------------------------------------------------------------
|
64
|
+
# Sub operations
|
65
|
+
|
66
|
+
def render_node_facts(node)
|
67
|
+
format = settings[:format]
|
68
|
+
myself.result = node.facts
|
69
|
+
render result, :format => format
|
70
|
+
end
|
71
|
+
|
72
|
+
#---
|
73
|
+
|
74
|
+
def render_node_fact(node, name)
|
75
|
+
format = settings[:format]
|
76
|
+
myself.result = node.fact(name)
|
77
|
+
render result, :format => format
|
78
|
+
end
|
79
|
+
|
80
|
+
#---
|
81
|
+
|
82
|
+
def delete_node_fact(node, name, remote = nil)
|
83
|
+
remote_text = remote ? "#{remote}" : "LOCAL ONLY"
|
84
|
+
|
85
|
+
node.delete_facts(name)
|
86
|
+
|
87
|
+
if node.save({ :remote => remote, :message => "Deleting fact #{name} from #{node.plugin_provider} #{node.plugin_name}" })
|
88
|
+
success("Fact #{name} deleted (#{remote_text})", { :i18n => false })
|
89
|
+
else
|
90
|
+
error("Fact #{name} deletion could not be saved", { :i18n => false })
|
91
|
+
myself.status = code.fact_save_failed
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
#---
|
96
|
+
|
97
|
+
def set_node_fact(node, name, value, remote = nil)
|
98
|
+
remote_text = remote ? "#{remote}" : "LOCAL ONLY"
|
99
|
+
input_format = settings[:input_format]
|
100
|
+
|
101
|
+
value = Util::Data.value(render(value, {
|
102
|
+
:format => input_format,
|
103
|
+
:silent => true
|
104
|
+
})) if input_format
|
105
|
+
|
106
|
+
myself.result = value
|
107
|
+
node.create_facts({ name => value })
|
108
|
+
|
109
|
+
if node.save({ :remote => remote, :message => "Saving fact #{name} to #{node.plugin_provider} #{node.plugin_name}" })
|
110
|
+
success("Fact #{name} saved (#{remote_text})", { :i18n => false })
|
111
|
+
else
|
112
|
+
error("New fact #{name} could not be saved", { :i18n => false })
|
113
|
+
myself.status = code.fact_save_failed
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
@@ -1,31 +1,31 @@
|
|
1
1
|
|
2
|
+
nucleon_require(File.dirname(__FILE__), :fact)
|
3
|
+
|
4
|
+
#---
|
5
|
+
|
2
6
|
module Nucleon
|
3
7
|
module Action
|
4
8
|
module Node
|
5
|
-
class Facts <
|
6
|
-
|
9
|
+
class Facts < Fact
|
10
|
+
|
7
11
|
#-----------------------------------------------------------------------------
|
8
12
|
# Info
|
9
13
|
|
10
14
|
def self.describe
|
11
|
-
super(:
|
15
|
+
super(:facts, 571)
|
12
16
|
end
|
13
|
-
|
17
|
+
|
14
18
|
#-----------------------------------------------------------------------------
|
15
19
|
# Settings
|
16
20
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
ui.info(Util::Data.to_json(facter_facts, true), { :prefix => false })
|
26
|
-
myself.result = facter_facts
|
27
|
-
end
|
28
|
-
end
|
21
|
+
def configure
|
22
|
+
super(true)
|
23
|
+
end
|
24
|
+
|
25
|
+
#---
|
26
|
+
|
27
|
+
def arguments
|
28
|
+
[]
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
|
2
|
+
module Nucleon
|
3
|
+
module Action
|
4
|
+
module Node
|
5
|
+
class Group < CORL.plugin_class(:nucleon, :cloud_action)
|
6
|
+
|
7
|
+
include Mixin::Action::Registration
|
8
|
+
|
9
|
+
#-----------------------------------------------------------------------------
|
10
|
+
# Info
|
11
|
+
|
12
|
+
def self.describe(action = :group, weight = 670)
|
13
|
+
super(:node, action, weight)
|
14
|
+
end
|
15
|
+
|
16
|
+
#-----------------------------------------------------------------------------
|
17
|
+
# Settings
|
18
|
+
|
19
|
+
def configure(aggregate = false)
|
20
|
+
super() do
|
21
|
+
codes :group_save_failed
|
22
|
+
|
23
|
+
unless aggregate
|
24
|
+
register_str :name, nil
|
25
|
+
|
26
|
+
register_bool :add
|
27
|
+
register_bool :delete
|
28
|
+
end
|
29
|
+
|
30
|
+
register_translator :format, :json
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
#---
|
35
|
+
|
36
|
+
def arguments
|
37
|
+
[ :name ]
|
38
|
+
end
|
39
|
+
|
40
|
+
#-----------------------------------------------------------------------------
|
41
|
+
# Operations
|
42
|
+
|
43
|
+
def execute
|
44
|
+
super do |node, network|
|
45
|
+
ensure_node(node) do
|
46
|
+
if ! settings[:name] || settings[:name].empty?
|
47
|
+
render_node_groups(node)
|
48
|
+
else
|
49
|
+
if settings.delete(:delete, false)
|
50
|
+
delete_node_group(node, settings[:name], sanitize_remote(network, settings[:net_remote]))
|
51
|
+
elsif settings.delete(:add, false)
|
52
|
+
set_node_group(node, settings[:name], sanitize_remote(network, settings[:net_remote]))
|
53
|
+
else
|
54
|
+
render_node_group(node, settings[:name])
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
#-----------------------------------------------------------------------------
|
62
|
+
# Sub operations
|
63
|
+
|
64
|
+
def render_node_groups(node)
|
65
|
+
format = settings[:format]
|
66
|
+
myself.result = node.groups
|
67
|
+
render result, :format => format
|
68
|
+
end
|
69
|
+
|
70
|
+
#---
|
71
|
+
|
72
|
+
def render_node_group(node, name)
|
73
|
+
if node.groups.include?(name.to_s)
|
74
|
+
myself.result = true
|
75
|
+
success("Group #{name} found", { :i18n => false })
|
76
|
+
else
|
77
|
+
myself.result = false
|
78
|
+
warn("Group #{name} not found", { :i18n => false })
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
#---
|
83
|
+
|
84
|
+
def delete_node_group(node, name, remote = nil)
|
85
|
+
remote_text = remote ? "#{remote}" : "LOCAL ONLY"
|
86
|
+
|
87
|
+
node.remove_groups(name)
|
88
|
+
|
89
|
+
if node.save({ :remote => remote, :message => "Deleting group #{name} from #{node.plugin_provider} #{node.plugin_name}" })
|
90
|
+
success("Group #{name} deleted (#{remote_text})", { :i18n => false })
|
91
|
+
else
|
92
|
+
error("Group #{name} deletion could not be saved", { :i18n => false })
|
93
|
+
myself.status = code.group_save_failed
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
#---
|
98
|
+
|
99
|
+
def set_node_group(node, name, remote = nil)
|
100
|
+
remote_text = remote ? "#{remote}" : "LOCAL ONLY"
|
101
|
+
|
102
|
+
myself.result = name
|
103
|
+
node.add_groups(name)
|
104
|
+
|
105
|
+
if node.save({ :remote => remote, :message => "Saving group #{name} to #{node.plugin_provider} #{node.plugin_name}" })
|
106
|
+
success("Group #{name} saved (#{remote_text})", { :i18n => false })
|
107
|
+
else
|
108
|
+
error("New group #{name} could not be saved", { :i18n => false })
|
109
|
+
myself.status = code.group_save_failed
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
|
2
|
+
nucleon_require(File.dirname(__FILE__), :group)
|
3
|
+
|
4
|
+
#---
|
5
|
+
|
6
|
+
module Nucleon
|
7
|
+
module Action
|
8
|
+
module Node
|
9
|
+
class Groups < Group
|
10
|
+
|
11
|
+
#-----------------------------------------------------------------------------
|
12
|
+
# Info
|
13
|
+
|
14
|
+
def self.describe
|
15
|
+
super(:groups, 671)
|
16
|
+
end
|
17
|
+
|
18
|
+
#-----------------------------------------------------------------------------
|
19
|
+
# Settings
|
20
|
+
|
21
|
+
def configure
|
22
|
+
super(true)
|
23
|
+
end
|
24
|
+
|
25
|
+
#---
|
26
|
+
|
27
|
+
def arguments
|
28
|
+
[]
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
|
2
|
+
module Nucleon
|
3
|
+
module Action
|
4
|
+
module Node
|
5
|
+
class Identity < CORL.plugin_class(:nucleon, :cloud_action)
|
6
|
+
|
7
|
+
include Mixin::Action::Registration
|
8
|
+
|
9
|
+
#-----------------------------------------------------------------------------
|
10
|
+
# Info
|
11
|
+
|
12
|
+
def self.describe
|
13
|
+
super(:node, :identity, 700)
|
14
|
+
end
|
15
|
+
|
16
|
+
#-----------------------------------------------------------------------------
|
17
|
+
# Settings
|
18
|
+
|
19
|
+
def configure
|
20
|
+
super do
|
21
|
+
codes :identity_upload_failure
|
22
|
+
|
23
|
+
register :name, :str
|
24
|
+
register_project :identity
|
25
|
+
register_nodes :identity_nodes
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
#---
|
30
|
+
|
31
|
+
def ignore
|
32
|
+
[ :nodes ]
|
33
|
+
end
|
34
|
+
|
35
|
+
def arguments
|
36
|
+
[ :name, :identity_nodes ]
|
37
|
+
end
|
38
|
+
|
39
|
+
#-----------------------------------------------------------------------------
|
40
|
+
# Operations
|
41
|
+
|
42
|
+
def execute
|
43
|
+
super do |local_node, network|
|
44
|
+
ensure_network(network) do
|
45
|
+
builder = network.identity_builder({ settings[:name] => settings[:identity] })
|
46
|
+
|
47
|
+
if builder.build(local_node)
|
48
|
+
identity_directory = File.join(builder.build_directory, settings[:name])
|
49
|
+
|
50
|
+
success = network.batch(settings[:identity_nodes], settings[:node_provider], settings[:parallel]) do |node|
|
51
|
+
info('corl.actions.identity.start', { :provider => node.plugin_provider, :name => node.plugin_name })
|
52
|
+
|
53
|
+
remote_network_directory = node.lookup(:corl_network)
|
54
|
+
|
55
|
+
remote_config_directory = File.join(remote_network_directory, network.config_directory.sub(/#{network.directory}#{File::SEPARATOR}/, ''))
|
56
|
+
remote_identity_base_directory = File.join(remote_network_directory, builder.build_directory.sub(/#{network.directory}#{File::SEPARATOR}/, ''))
|
57
|
+
remote_identity_directory = File.join(remote_identity_base_directory, settings[:name])
|
58
|
+
|
59
|
+
node.cli.mkdir('-p', remote_identity_base_directory)
|
60
|
+
node.cli.rm('-Rf', remote_identity_directory)
|
61
|
+
|
62
|
+
if success = node.send_files(identity_directory, remote_identity_directory, nil, '0700')
|
63
|
+
dbg('we were successful!')
|
64
|
+
end
|
65
|
+
success
|
66
|
+
end
|
67
|
+
end
|
68
|
+
myself.status = code.batch_error unless success
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -4,6 +4,8 @@ module Action
|
|
4
4
|
module Node
|
5
5
|
class Lookup < CORL.plugin_class(:nucleon, :cloud_action)
|
6
6
|
|
7
|
+
include Mixin::Action::Registration
|
8
|
+
|
7
9
|
#-----------------------------------------------------------------------------
|
8
10
|
# Info
|
9
11
|
|
@@ -16,7 +18,7 @@ class Lookup < CORL.plugin_class(:nucleon, :cloud_action)
|
|
16
18
|
|
17
19
|
def configure
|
18
20
|
super do
|
19
|
-
register :
|
21
|
+
register :properties, :array, []
|
20
22
|
register :context, :str, :priority do |value|
|
21
23
|
success = true
|
22
24
|
options = [ :priority, :array, :hash ]
|
@@ -26,13 +28,15 @@ class Lookup < CORL.plugin_class(:nucleon, :cloud_action)
|
|
26
28
|
end
|
27
29
|
success
|
28
30
|
end
|
31
|
+
|
32
|
+
register_translator :format, :json
|
29
33
|
end
|
30
34
|
end
|
31
35
|
|
32
36
|
#---
|
33
37
|
|
34
38
|
def arguments
|
35
|
-
[ :
|
39
|
+
[ :properties ]
|
36
40
|
end
|
37
41
|
|
38
42
|
#-----------------------------------------------------------------------------
|
@@ -41,11 +45,20 @@ class Lookup < CORL.plugin_class(:nucleon, :cloud_action)
|
|
41
45
|
def execute
|
42
46
|
super do |node, network|
|
43
47
|
ensure_node(node) do
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
48
|
+
translator = CORL.translator({}, settings[:format])
|
49
|
+
|
50
|
+
if settings[:properties].empty?
|
51
|
+
myself.result = node.hiera_configuration(node.facts)
|
52
|
+
$stderr.puts translator.generate(result)
|
53
|
+
else
|
54
|
+
properties = {}
|
55
|
+
|
56
|
+
settings.delete(:properties).each do |property|
|
57
|
+
properties[property] = node.lookup(property, nil, settings)
|
58
|
+
end
|
59
|
+
$stderr.puts translator.generate(properties)
|
60
|
+
myself.result = properties
|
61
|
+
end
|
49
62
|
end
|
50
63
|
end
|
51
64
|
end
|
@@ -64,7 +64,7 @@ class Seed < CORL.plugin_class(:nucleon, :cloud_action)
|
|
64
64
|
network_path = lookup(:corl_network)
|
65
65
|
backup_path = File.join(Dir.tmpdir(), 'corl')
|
66
66
|
|
67
|
-
|
67
|
+
info("Generating network SSH deploy keys", { :i18n => false })
|
68
68
|
|
69
69
|
if keys = Util::SSH.generate.store
|
70
70
|
if @project_info
|
@@ -73,11 +73,11 @@ class Seed < CORL.plugin_class(:nucleon, :cloud_action)
|
|
73
73
|
project_info = Config.new({ :provider => :git })
|
74
74
|
end
|
75
75
|
|
76
|
-
|
76
|
+
info("Backing up current network configuration", { :i18n => false })
|
77
77
|
FileUtils.rm_rf(backup_path)
|
78
78
|
FileUtils.mv(network_path, backup_path)
|
79
79
|
|
80
|
-
|
80
|
+
info("Seeding network configuration from #{settings[:project_reference]}", { :i18n => false })
|
81
81
|
project = CORL.project(extended_config(:project, {
|
82
82
|
:directory => network_path,
|
83
83
|
:reference => project_info.get(:reference, nil),
|
@@ -90,15 +90,15 @@ class Seed < CORL.plugin_class(:nucleon, :cloud_action)
|
|
90
90
|
}), project_info[:provider])
|
91
91
|
|
92
92
|
if project
|
93
|
-
|
93
|
+
info("Finalizing network path and removing temporary backup", { :i18n => false })
|
94
94
|
FileUtils.chmod_R(0600, network_path)
|
95
95
|
FileUtils.rm_rf(backup_path)
|
96
96
|
|
97
|
-
|
97
|
+
info("Reinitializing network", { :i18n => false })
|
98
98
|
if network = init_network
|
99
99
|
if network.load
|
100
100
|
if node = network.local_node(true)
|
101
|
-
|
101
|
+
info("Updating node network configurations", { :i18n => false })
|
102
102
|
myself.status = code.node_save_failure unless node.save
|
103
103
|
else
|
104
104
|
myself.status = code.node_load_failure
|
@@ -0,0 +1,76 @@
|
|
1
|
+
|
2
|
+
module Nucleon
|
3
|
+
module Action
|
4
|
+
module Node
|
5
|
+
class Status < CORL.plugin_class(:nucleon, :cloud_action)
|
6
|
+
|
7
|
+
include Mixin::Action::Registration
|
8
|
+
|
9
|
+
#-----------------------------------------------------------------------------
|
10
|
+
# Info
|
11
|
+
|
12
|
+
def self.describe
|
13
|
+
super(:node, :status, 800)
|
14
|
+
end
|
15
|
+
|
16
|
+
#-----------------------------------------------------------------------------
|
17
|
+
# Settings
|
18
|
+
|
19
|
+
def configure
|
20
|
+
super do
|
21
|
+
register_nodes :status_nodes, []
|
22
|
+
|
23
|
+
register_bool :basic
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
#---
|
28
|
+
|
29
|
+
def ignore
|
30
|
+
[ :nodes ]
|
31
|
+
end
|
32
|
+
|
33
|
+
def arguments
|
34
|
+
[ :status_nodes ]
|
35
|
+
end
|
36
|
+
|
37
|
+
#-----------------------------------------------------------------------------
|
38
|
+
# Operations
|
39
|
+
|
40
|
+
def execute
|
41
|
+
super do |local_node, network|
|
42
|
+
ensure_network(network) do
|
43
|
+
settings[:status_nodes] = [ 'all' ] if settings[:status_nodes].empty?
|
44
|
+
|
45
|
+
batch_success = network.batch(settings[:status_nodes], settings[:node_provider], settings[:parallel]) do |node|
|
46
|
+
state = node.state(true).to_sym
|
47
|
+
ssh_enabled = ''
|
48
|
+
|
49
|
+
case state
|
50
|
+
when :running, :active
|
51
|
+
state = green(state.to_s)
|
52
|
+
|
53
|
+
unless settings[:basic]
|
54
|
+
result = node.cli.test :true
|
55
|
+
|
56
|
+
if result.status == code.success
|
57
|
+
ssh_enabled = '[ ' + green('connected') + ' ]'
|
58
|
+
else
|
59
|
+
ssh_enabled = '[ ' + red('connection failed') + ' ]'
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
when :stopped, :aborted
|
64
|
+
state = red(state.to_s)
|
65
|
+
end
|
66
|
+
info(state + " #{ssh_enabled}".rstrip, { :i18n => false, :prefix_text => yellow(node.plugin_provider) + ' ' + purple(node.plugin_name) })
|
67
|
+
true
|
68
|
+
end
|
69
|
+
myself.status = code.batch_error unless batch_success
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|