corl 0.5.2 → 0.5.3
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.
- checksums.yaml +7 -7
- data/.gitignore +51 -0
- data/Gemfile +6 -11
- data/Gemfile.lock +122 -147
- data/Rakefile +22 -21
- data/TODO.rdoc +12 -0
- data/VERSION +1 -1
- data/bin/corl +15 -21
- data/bootstrap/bootstrap.sh +50 -16
- data/bootstrap/lib/shell/os.sh +2 -2
- data/bootstrap/os/ubuntu/00_base.sh +11 -4
- data/bootstrap/os/ubuntu/01_git.sh +6 -3
- data/bootstrap/os/ubuntu/{02-editor.sh → 02_editor.sh} +8 -2
- data/bootstrap/os/ubuntu/05_ruby.sh +63 -15
- data/bootstrap/os/ubuntu/06_puppet.sh +9 -4
- data/bootstrap/os/ubuntu/09_nucleon.sh +25 -9
- data/bootstrap/os/ubuntu/10_corl.sh +24 -10
- data/corl.gemspec +27 -502
- data/lib/CORL/configuration/file.rb +112 -112
- data/lib/CORL/machine/rackspace.rb +18 -17
- data/lib/core/facade.rb +1 -1
- data/lib/core/plugin/agent.rb +141 -0
- data/lib/core/plugin/cloud_action.rb +67 -62
- data/lib/core/plugin/configuration.rb +71 -70
- data/lib/core/plugin/network.rb +163 -151
- data/lib/core/plugin/node.rb +457 -422
- data/lib/core/vagrant/commands/launcher.rb +13 -13
- data/lib/core/vagrant/provisioner/config.rb +1 -3
- data/lib/nucleon/action/node/bootstrap.rb +21 -16
- data/lib/nucleon/action/node/destroy.rb +13 -13
- data/lib/nucleon/action/node/seed.rb +62 -64
- data/lib/nucleon/action/node/status.rb +39 -32
- data/locales/en.yml +121 -116
- data/spec/spec_helper.rb +1 -4
- metadata +111 -641
- data/.document +0 -5
- data/lib/core/mod/fog_rackspace_server.rb +0 -29
- data/lib/core/vagrant/Vagrantfile +0 -10
- data/lib/nucleon/action/plugin/template/nucleon.action.erb +0 -56
- data/rdoc/site/0.4.29/CORL/Action/Authorize.html +0 -485
- data/rdoc/site/0.4.29/CORL/Action/Bootstrap.html +0 -546
- data/rdoc/site/0.4.29/CORL/Action/Build.html +0 -396
- data/rdoc/site/0.4.29/CORL/Action/Destroy.html +0 -515
- data/rdoc/site/0.4.29/CORL/Action/Exec.html +0 -472
- data/rdoc/site/0.4.29/CORL/Action/Facts.html +0 -398
- data/rdoc/site/0.4.29/CORL/Action/Image.html +0 -515
- data/rdoc/site/0.4.29/CORL/Action/Images.html +0 -514
- data/rdoc/site/0.4.29/CORL/Action/Ip.html +0 -395
- data/rdoc/site/0.4.29/CORL/Action/Keypair.html +0 -494
- data/rdoc/site/0.4.29/CORL/Action/Lookup.html +0 -474
- data/rdoc/site/0.4.29/CORL/Action/Machines.html +0 -509
- data/rdoc/site/0.4.29/CORL/Action/Provision.html +0 -456
- data/rdoc/site/0.4.29/CORL/Action/Reboot.html +0 -515
- data/rdoc/site/0.4.29/CORL/Action/Regions.html +0 -509
- data/rdoc/site/0.4.29/CORL/Action/Revoke.html +0 -483
- data/rdoc/site/0.4.29/CORL/Action/Seed.html +0 -544
- data/rdoc/site/0.4.29/CORL/Action/Spawn.html +0 -616
- data/rdoc/site/0.4.29/CORL/Action/Ssh.html +0 -526
- data/rdoc/site/0.4.29/CORL/Action/Start.html +0 -515
- data/rdoc/site/0.4.29/CORL/Action/Stop.html +0 -515
- data/rdoc/site/0.4.29/CORL/Action/Vagrantfile.html +0 -457
- data/rdoc/site/0.4.29/CORL/Action.html +0 -360
- data/rdoc/site/0.4.29/CORL/Configuration/File.html +0 -1128
- data/rdoc/site/0.4.29/CORL/Configuration.html +0 -339
- data/rdoc/site/0.4.29/CORL/Errors.html +0 -339
- data/rdoc/site/0.4.29/CORL/Event/Puppet.html +0 -673
- data/rdoc/site/0.4.29/CORL/Event.html +0 -339
- data/rdoc/site/0.4.29/CORL/Facade.html +0 -742
- data/rdoc/site/0.4.29/CORL/Machine/Aws.html +0 -733
- data/rdoc/site/0.4.29/CORL/Machine/Fog.html +0 -1269
- data/rdoc/site/0.4.29/CORL/Machine/Physical.html +0 -1039
- data/rdoc/site/0.4.29/CORL/Machine/Rackspace.html +0 -514
- data/rdoc/site/0.4.29/CORL/Machine/Vagrant.html +0 -1300
- data/rdoc/site/0.4.29/CORL/Machine.html +0 -343
- data/rdoc/site/0.4.29/CORL/Mixin/Action/Keypair.html +0 -572
- data/rdoc/site/0.4.29/CORL/Mixin/Action.html +0 -339
- data/rdoc/site/0.4.29/CORL/Mixin/Lookup.html +0 -954
- data/rdoc/site/0.4.29/CORL/Mixin/Machine/SSH.html +0 -643
- data/rdoc/site/0.4.29/CORL/Mixin/Machine.html +0 -339
- data/rdoc/site/0.4.29/CORL/Mixin/Macro/NetworkSettings.html +0 -464
- data/rdoc/site/0.4.29/CORL/Mixin/Macro.html +0 -339
- data/rdoc/site/0.4.29/CORL/Mixin.html +0 -342
- data/rdoc/site/0.4.29/CORL/Network/Default.html +0 -391
- data/rdoc/site/0.4.29/CORL/Network.html +0 -339
- data/rdoc/site/0.4.29/CORL/Node/Aws.html +0 -716
- data/rdoc/site/0.4.29/CORL/Node/Fog.html +0 -1192
- data/rdoc/site/0.4.29/CORL/Node/Local.html +0 -424
- data/rdoc/site/0.4.29/CORL/Node/Rackspace.html +0 -709
- data/rdoc/site/0.4.29/CORL/Node/Vagrant.html +0 -1451
- data/rdoc/site/0.4.29/CORL/Node.html +0 -343
- data/rdoc/site/0.4.29/CORL/Plugin/CloudAction.html +0 -810
- data/rdoc/site/0.4.29/CORL/Plugin.html +0 -339
- data/rdoc/site/0.4.29/CORL/Provisioner/Puppetnode.html +0 -1095
- data/rdoc/site/0.4.29/CORL/Provisioner.html +0 -339
- data/rdoc/site/0.4.29/CORL/Template/Environment.html +0 -528
- data/rdoc/site/0.4.29/CORL/Template.html +0 -339
- data/rdoc/site/0.4.29/CORL/Util/Puppet/Resource.html +0 -1038
- data/rdoc/site/0.4.29/CORL/Util/Puppet/ResourceGroup.html +0 -920
- data/rdoc/site/0.4.29/CORL/Util/Puppet.html +0 -1087
- data/rdoc/site/0.4.29/CORL/Util.html +0 -341
- data/rdoc/site/0.4.29/CORL/Vagrant/Config.html +0 -896
- data/rdoc/site/0.4.29/CORL/Vagrant.html +0 -418
- data/rdoc/site/0.4.29/CORL.html +0 -465
- data/rdoc/site/0.4.29/Facter/Util/Loader.html +0 -396
- data/rdoc/site/0.4.29/Facter/Util.html +0 -339
- data/rdoc/site/0.4.29/Facter.html +0 -339
- data/rdoc/site/0.4.29/Fog/Compute/AWS/Server.html +0 -423
- data/rdoc/site/0.4.29/Fog/Compute/AWS.html +0 -345
- data/rdoc/site/0.4.29/Fog/Compute/RackspaceV2/Server.html +0 -408
- data/rdoc/site/0.4.29/Fog/Compute/RackspaceV2.html +0 -345
- data/rdoc/site/0.4.29/Fog/Compute.html +0 -340
- data/rdoc/site/0.4.29/Fog.html +0 -340
- data/rdoc/site/0.4.29/Hiera/Backend.html +0 -422
- data/rdoc/site/0.4.29/Hiera/Corl_logger.html +0 -449
- data/rdoc/site/0.4.29/Hiera.html +0 -346
- data/rdoc/site/0.4.29/Nucleon/Config.html +0 -357
- data/rdoc/site/0.4.29/Nucleon/Plugin/Base.html +0 -345
- data/rdoc/site/0.4.29/Nucleon/Plugin/Configuration.html +0 -1213
- data/rdoc/site/0.4.29/Nucleon/Plugin/Machine.html +0 -1279
- data/rdoc/site/0.4.29/Nucleon/Plugin/Network.html +0 -1425
- data/rdoc/site/0.4.29/Nucleon/Plugin/Node.html +0 -3715
- data/rdoc/site/0.4.29/Nucleon/Plugin/Provisioner.html +0 -1297
- data/rdoc/site/0.4.29/Nucleon/Plugin.html +0 -344
- data/rdoc/site/0.4.29/Nucleon.html +0 -344
- data/rdoc/site/0.4.29/Object.html +0 -358
- data/rdoc/site/0.4.29/Puppet/DataBinding/Corl.html +0 -345
- data/rdoc/site/0.4.29/Puppet/DataBinding.html +0 -338
- data/rdoc/site/0.4.29/Puppet/Indirector/Corl.html +0 -454
- data/rdoc/site/0.4.29/Puppet/Indirector.html +0 -338
- data/rdoc/site/0.4.29/Puppet/Parser/Functions.html +0 -480
- data/rdoc/site/0.4.29/Puppet/Parser.html +0 -338
- data/rdoc/site/0.4.29/Puppet.html +0 -338
- data/rdoc/site/0.4.29/README_rdoc.html +0 -340
- data/rdoc/site/0.4.29/Vagrant/Config/Loader.html +0 -399
- data/rdoc/site/0.4.29/Vagrant/Config.html +0 -339
- data/rdoc/site/0.4.29/Vagrant/Vagrantfile.html +0 -392
- data/rdoc/site/0.4.29/Vagrant.html +0 -346
- data/rdoc/site/0.4.29/VagrantPlugins/CORL/Action/DeleteCache.html +0 -396
- data/rdoc/site/0.4.29/VagrantPlugins/CORL/Action/InitKeys.html +0 -408
- data/rdoc/site/0.4.29/VagrantPlugins/CORL/Action/LinkNetwork.html +0 -406
- data/rdoc/site/0.4.29/VagrantPlugins/CORL/Action.html +0 -341
- data/rdoc/site/0.4.29/VagrantPlugins/CORL/BaseAction.html +0 -491
- data/rdoc/site/0.4.29/VagrantPlugins/CORL/Command/Launcher.html +0 -533
- data/rdoc/site/0.4.29/VagrantPlugins/CORL/Command.html +0 -339
- data/rdoc/site/0.4.29/VagrantPlugins/CORL/Config/CORL.html +0 -732
- data/rdoc/site/0.4.29/VagrantPlugins/CORL/Config.html +0 -339
- data/rdoc/site/0.4.29/VagrantPlugins/CORL/Plugin.html +0 -345
- data/rdoc/site/0.4.29/VagrantPlugins/CORL/Provisioner/CORL.html +0 -536
- data/rdoc/site/0.4.29/VagrantPlugins/CORL/Provisioner.html +0 -339
- data/rdoc/site/0.4.29/VagrantPlugins/CORL.html +0 -346
- data/rdoc/site/0.4.29/VagrantPlugins.html +0 -346
- data/rdoc/site/0.4.29/created.rid +0 -96
- data/rdoc/site/0.4.29/images/add.png +0 -0
- data/rdoc/site/0.4.29/images/brick.png +0 -0
- data/rdoc/site/0.4.29/images/brick_link.png +0 -0
- data/rdoc/site/0.4.29/images/bug.png +0 -0
- data/rdoc/site/0.4.29/images/bullet_black.png +0 -0
- data/rdoc/site/0.4.29/images/bullet_toggle_minus.png +0 -0
- data/rdoc/site/0.4.29/images/bullet_toggle_plus.png +0 -0
- data/rdoc/site/0.4.29/images/date.png +0 -0
- data/rdoc/site/0.4.29/images/delete.png +0 -0
- data/rdoc/site/0.4.29/images/find.png +0 -0
- data/rdoc/site/0.4.29/images/loadingAnimation.gif +0 -0
- data/rdoc/site/0.4.29/images/macFFBgHack.png +0 -0
- data/rdoc/site/0.4.29/images/package.png +0 -0
- data/rdoc/site/0.4.29/images/page_green.png +0 -0
- data/rdoc/site/0.4.29/images/page_white_text.png +0 -0
- data/rdoc/site/0.4.29/images/page_white_width.png +0 -0
- data/rdoc/site/0.4.29/images/plugin.png +0 -0
- data/rdoc/site/0.4.29/images/ruby.png +0 -0
- data/rdoc/site/0.4.29/images/tag_blue.png +0 -0
- data/rdoc/site/0.4.29/images/tag_green.png +0 -0
- data/rdoc/site/0.4.29/images/transparent.png +0 -0
- data/rdoc/site/0.4.29/images/wrench.png +0 -0
- data/rdoc/site/0.4.29/images/wrench_orange.png +0 -0
- data/rdoc/site/0.4.29/images/zoom.png +0 -0
- data/rdoc/site/0.4.29/index.html +0 -339
- data/rdoc/site/0.4.29/js/darkfish.js +0 -155
- data/rdoc/site/0.4.29/js/jquery.js +0 -18
- data/rdoc/site/0.4.29/js/navigation.js +0 -142
- data/rdoc/site/0.4.29/js/search.js +0 -94
- data/rdoc/site/0.4.29/js/search_index.js +0 -1
- data/rdoc/site/0.4.29/js/searcher.js +0 -228
- data/rdoc/site/0.4.29/rdoc.css +0 -543
- data/rdoc/site/0.4.29/table_of_contents.html +0 -1561
- data/rdoc/site/0.5.0/CORL/Build.html +0 -757
- data/rdoc/site/0.5.0/CORL/Builder/Identity.html +0 -569
- data/rdoc/site/0.5.0/CORL/Builder/Package.html +0 -576
- data/rdoc/site/0.5.0/CORL/Builder.html +0 -360
- data/rdoc/site/0.5.0/CORL/Configuration/File.html +0 -1148
- data/rdoc/site/0.5.0/CORL/Configuration.html +0 -359
- data/rdoc/site/0.5.0/CORL/Errors.html +0 -359
- data/rdoc/site/0.5.0/CORL/Facade.html +0 -899
- data/rdoc/site/0.5.0/CORL/Machine/AWS.html +0 -753
- data/rdoc/site/0.5.0/CORL/Machine/Fog.html +0 -1289
- data/rdoc/site/0.5.0/CORL/Machine/Physical.html +0 -1059
- data/rdoc/site/0.5.0/CORL/Machine/Rackspace.html +0 -534
- data/rdoc/site/0.5.0/CORL/Machine/Vagrant.html +0 -1320
- data/rdoc/site/0.5.0/CORL/Machine.html +0 -363
- data/rdoc/site/0.5.0/CORL/Mixin/Action/Keypair.html +0 -592
- data/rdoc/site/0.5.0/CORL/Mixin/Action.html +0 -359
- data/rdoc/site/0.5.0/CORL/Mixin/Builder/Global.html +0 -604
- data/rdoc/site/0.5.0/CORL/Mixin/Builder/Instance.html +0 -696
- data/rdoc/site/0.5.0/CORL/Mixin/Builder.html +0 -359
- data/rdoc/site/0.5.0/CORL/Mixin/Lookup.html +0 -1139
- data/rdoc/site/0.5.0/CORL/Mixin/Machine/SSH.html +0 -675
- data/rdoc/site/0.5.0/CORL/Mixin/Machine.html +0 -359
- data/rdoc/site/0.5.0/CORL/Mixin/Macro/NetworkSettings.html +0 -484
- data/rdoc/site/0.5.0/CORL/Mixin/Macro.html +0 -359
- data/rdoc/site/0.5.0/CORL/Mixin.html +0 -363
- data/rdoc/site/0.5.0/CORL/Network/CORL.html +0 -411
- data/rdoc/site/0.5.0/CORL/Network.html +0 -359
- data/rdoc/site/0.5.0/CORL/Node/AWS.html +0 -736
- data/rdoc/site/0.5.0/CORL/Node/Fog.html +0 -1212
- data/rdoc/site/0.5.0/CORL/Node/Local.html +0 -444
- data/rdoc/site/0.5.0/CORL/Node/Rackspace.html +0 -729
- data/rdoc/site/0.5.0/CORL/Node/Vagrant.html +0 -1476
- data/rdoc/site/0.5.0/CORL/Node.html +0 -363
- data/rdoc/site/0.5.0/CORL/Plugin/Builder.html +0 -500
- data/rdoc/site/0.5.0/CORL/Plugin/Configuration.html +0 -1271
- data/rdoc/site/0.5.0/CORL/Plugin/Machine.html +0 -1299
- data/rdoc/site/0.5.0/CORL/Plugin/Network.html +0 -1580
- data/rdoc/site/0.5.0/CORL/Plugin/Node.html +0 -4041
- data/rdoc/site/0.5.0/CORL/Plugin/Provisioner.html +0 -1115
- data/rdoc/site/0.5.0/CORL/Plugin.html +0 -649
- data/rdoc/site/0.5.0/CORL/Provisioner/Puppetnode.html +0 -1177
- data/rdoc/site/0.5.0/CORL/Provisioner.html +0 -359
- data/rdoc/site/0.5.0/CORL/Util/Puppet/Resource.html +0 -1058
- data/rdoc/site/0.5.0/CORL/Util/Puppet/ResourceGroup.html +0 -940
- data/rdoc/site/0.5.0/CORL/Util/Puppet.html +0 -1107
- data/rdoc/site/0.5.0/CORL/Util.html +0 -361
- data/rdoc/site/0.5.0/CORL/Vagrant/Config.html +0 -943
- data/rdoc/site/0.5.0/CORL/Vagrant.html +0 -438
- data/rdoc/site/0.5.0/CORL.html +0 -471
- data/rdoc/site/0.5.0/Fog/Compute/AWS/Server.html +0 -443
- data/rdoc/site/0.5.0/Fog/Compute/AWS.html +0 -365
- data/rdoc/site/0.5.0/Fog/Compute/RackspaceV2/Server.html +0 -428
- data/rdoc/site/0.5.0/Fog/Compute/RackspaceV2.html +0 -365
- data/rdoc/site/0.5.0/Fog/Compute.html +0 -360
- data/rdoc/site/0.5.0/Fog.html +0 -360
- data/rdoc/site/0.5.0/Hiera/Backend.html +0 -442
- data/rdoc/site/0.5.0/Hiera/Corl_logger.html +0 -469
- data/rdoc/site/0.5.0/Hiera.html +0 -366
- data/rdoc/site/0.5.0/Nucleon/Action/Cloud/Create.html +0 -538
- data/rdoc/site/0.5.0/Nucleon/Action/Cloud/Hiera.html +0 -566
- data/rdoc/site/0.5.0/Nucleon/Action/Cloud/Images.html +0 -572
- data/rdoc/site/0.5.0/Nucleon/Action/Cloud/Inspect.html +0 -524
- data/rdoc/site/0.5.0/Nucleon/Action/Cloud/Machines.html +0 -567
- data/rdoc/site/0.5.0/Nucleon/Action/Cloud/Regions.html +0 -567
- data/rdoc/site/0.5.0/Nucleon/Action/Cloud/Vagrantfile.html +0 -515
- data/rdoc/site/0.5.0/Nucleon/Action/Cloud.html +0 -365
- data/rdoc/site/0.5.0/Nucleon/Action/Node/Authorize.html +0 -543
- data/rdoc/site/0.5.0/Nucleon/Action/Node/Bootstrap.html +0 -604
- data/rdoc/site/0.5.0/Nucleon/Action/Node/Build.html +0 -526
- data/rdoc/site/0.5.0/Nucleon/Action/Node/Destroy.html +0 -573
- data/rdoc/site/0.5.0/Nucleon/Action/Node/Exec.html +0 -530
- data/rdoc/site/0.5.0/Nucleon/Action/Node/Facts.html +0 -456
- data/rdoc/site/0.5.0/Nucleon/Action/Node/IP.html +0 -453
- data/rdoc/site/0.5.0/Nucleon/Action/Node/Image.html +0 -573
- data/rdoc/site/0.5.0/Nucleon/Action/Node/Keypair.html +0 -572
- data/rdoc/site/0.5.0/Nucleon/Action/Node/Lookup.html +0 -532
- data/rdoc/site/0.5.0/Nucleon/Action/Node/Provision.html +0 -553
- data/rdoc/site/0.5.0/Nucleon/Action/Node/Reboot.html +0 -573
- data/rdoc/site/0.5.0/Nucleon/Action/Node/Revoke.html +0 -541
- data/rdoc/site/0.5.0/Nucleon/Action/Node/SSH.html +0 -583
- data/rdoc/site/0.5.0/Nucleon/Action/Node/Seed.html +0 -602
- data/rdoc/site/0.5.0/Nucleon/Action/Node/Spawn.html +0 -675
- data/rdoc/site/0.5.0/Nucleon/Action/Node/Start.html +0 -573
- data/rdoc/site/0.5.0/Nucleon/Action/Node/Stop.html +0 -573
- data/rdoc/site/0.5.0/Nucleon/Action/Node.html +0 -376
- data/rdoc/site/0.5.0/Nucleon/Action.html +0 -383
- data/rdoc/site/0.5.0/Nucleon/Config.html +0 -377
- data/rdoc/site/0.5.0/Nucleon/Event/Puppet.html +0 -693
- data/rdoc/site/0.5.0/Nucleon/Event.html +0 -359
- data/rdoc/site/0.5.0/Nucleon/Plugin/Base.html +0 -365
- data/rdoc/site/0.5.0/Nucleon/Plugin/CloudAction.html +0 -838
- data/rdoc/site/0.5.0/Nucleon/Plugin.html +0 -360
- data/rdoc/site/0.5.0/Nucleon/Template/Environment.html +0 -548
- data/rdoc/site/0.5.0/Nucleon/Template.html +0 -359
- data/rdoc/site/0.5.0/Nucleon.html +0 -387
- data/rdoc/site/0.5.0/Object.html +0 -378
- data/rdoc/site/0.5.0/Puppet/DataBinding/Corl.html +0 -365
- data/rdoc/site/0.5.0/Puppet/DataBinding.html +0 -358
- data/rdoc/site/0.5.0/Puppet/Indirector/Corl.html +0 -477
- data/rdoc/site/0.5.0/Puppet/Indirector.html +0 -358
- data/rdoc/site/0.5.0/Puppet/Parser/Functions.html +0 -500
- data/rdoc/site/0.5.0/Puppet/Parser.html +0 -358
- data/rdoc/site/0.5.0/Puppet.html +0 -358
- data/rdoc/site/0.5.0/README_rdoc.html +0 -360
- data/rdoc/site/0.5.0/Vagrant/Config/Loader.html +0 -419
- data/rdoc/site/0.5.0/Vagrant/Config.html +0 -359
- data/rdoc/site/0.5.0/Vagrant/Vagrantfile.html +0 -412
- data/rdoc/site/0.5.0/Vagrant.html +0 -366
- data/rdoc/site/0.5.0/VagrantPlugins/CORL/Action/DeleteCache.html +0 -422
- data/rdoc/site/0.5.0/VagrantPlugins/CORL/Action/InitKeys.html +0 -428
- data/rdoc/site/0.5.0/VagrantPlugins/CORL/Action/LinkNetwork.html +0 -426
- data/rdoc/site/0.5.0/VagrantPlugins/CORL/Action.html +0 -361
- data/rdoc/site/0.5.0/VagrantPlugins/CORL/BaseAction.html +0 -511
- data/rdoc/site/0.5.0/VagrantPlugins/CORL/Command/Launcher.html +0 -553
- data/rdoc/site/0.5.0/VagrantPlugins/CORL/Command.html +0 -359
- data/rdoc/site/0.5.0/VagrantPlugins/CORL/Config/CORL.html +0 -752
- data/rdoc/site/0.5.0/VagrantPlugins/CORL/Config.html +0 -359
- data/rdoc/site/0.5.0/VagrantPlugins/CORL/Plugin.html +0 -365
- data/rdoc/site/0.5.0/VagrantPlugins/CORL/Provisioner/CORL.html +0 -556
- data/rdoc/site/0.5.0/VagrantPlugins/CORL/Provisioner.html +0 -359
- data/rdoc/site/0.5.0/VagrantPlugins/CORL.html +0 -366
- data/rdoc/site/0.5.0/VagrantPlugins.html +0 -366
- data/rdoc/site/0.5.0/created.rid +0 -103
- 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 +0 -359
- data/rdoc/site/0.5.0/js/darkfish.js +0 -155
- data/rdoc/site/0.5.0/js/jquery.js +0 -18
- data/rdoc/site/0.5.0/js/navigation.js +0 -142
- data/rdoc/site/0.5.0/js/search.js +0 -94
- data/rdoc/site/0.5.0/js/search_index.js +0 -1
- data/rdoc/site/0.5.0/js/searcher.js +0 -228
- data/rdoc/site/0.5.0/rdoc.css +0 -543
- data/rdoc/site/0.5.0/table_of_contents.html +0 -1797
- data/rdoc/site/0.5.1/CORL/Build.html +0 -781
- data/rdoc/site/0.5.1/CORL/Builder/Identity.html +0 -596
- data/rdoc/site/0.5.1/CORL/Builder/Package.html +0 -600
- data/rdoc/site/0.5.1/CORL/Builder.html +0 -384
- data/rdoc/site/0.5.1/CORL/Configuration/File.html +0 -1186
- data/rdoc/site/0.5.1/CORL/Configuration.html +0 -383
- data/rdoc/site/0.5.1/CORL/Errors.html +0 -383
- data/rdoc/site/0.5.1/CORL/Facade.html +0 -927
- data/rdoc/site/0.5.1/CORL/Machine/AWS.html +0 -777
- data/rdoc/site/0.5.1/CORL/Machine/Fog.html +0 -1313
- data/rdoc/site/0.5.1/CORL/Machine/Physical.html +0 -1083
- data/rdoc/site/0.5.1/CORL/Machine/Rackspace.html +0 -558
- data/rdoc/site/0.5.1/CORL/Machine/Vagrant.html +0 -1344
- data/rdoc/site/0.5.1/CORL/Machine.html +0 -387
- data/rdoc/site/0.5.1/CORL/Mixin/Action/Keypair.html +0 -616
- data/rdoc/site/0.5.1/CORL/Mixin/Action/Registration.html +0 -469
- data/rdoc/site/0.5.1/CORL/Mixin/Action.html +0 -384
- data/rdoc/site/0.5.1/CORL/Mixin/Builder/Global.html +0 -628
- data/rdoc/site/0.5.1/CORL/Mixin/Builder/Instance.html +0 -720
- data/rdoc/site/0.5.1/CORL/Mixin/Builder.html +0 -383
- data/rdoc/site/0.5.1/CORL/Mixin/Lookup.html +0 -1315
- data/rdoc/site/0.5.1/CORL/Mixin/Machine/SSH.html +0 -699
- data/rdoc/site/0.5.1/CORL/Mixin/Machine.html +0 -383
- data/rdoc/site/0.5.1/CORL/Mixin/Macro/NetworkSettings.html +0 -508
- data/rdoc/site/0.5.1/CORL/Mixin/Macro.html +0 -383
- data/rdoc/site/0.5.1/CORL/Mixin.html +0 -388
- data/rdoc/site/0.5.1/CORL/Network/CORL.html +0 -435
- data/rdoc/site/0.5.1/CORL/Network.html +0 -383
- data/rdoc/site/0.5.1/CORL/Node/AWS.html +0 -760
- data/rdoc/site/0.5.1/CORL/Node/Fog.html +0 -1268
- data/rdoc/site/0.5.1/CORL/Node/Local.html +0 -468
- data/rdoc/site/0.5.1/CORL/Node/Rackspace.html +0 -753
- data/rdoc/site/0.5.1/CORL/Node/Vagrant.html +0 -1497
- data/rdoc/site/0.5.1/CORL/Node.html +0 -387
- data/rdoc/site/0.5.1/CORL/Plugin/Builder.html +0 -524
- data/rdoc/site/0.5.1/CORL/Plugin/Configuration.html +0 -1294
- data/rdoc/site/0.5.1/CORL/Plugin/Machine.html +0 -1323
- data/rdoc/site/0.5.1/CORL/Plugin/Network.html +0 -1766
- data/rdoc/site/0.5.1/CORL/Plugin/Node.html +0 -4263
- data/rdoc/site/0.5.1/CORL/Plugin/Provisioner.html +0 -1139
- data/rdoc/site/0.5.1/CORL/Plugin.html +0 -673
- data/rdoc/site/0.5.1/CORL/Provisioner/Puppetnode.html +0 -1201
- data/rdoc/site/0.5.1/CORL/Provisioner.html +0 -383
- data/rdoc/site/0.5.1/CORL/Util/Puppet/Resource.html +0 -1082
- data/rdoc/site/0.5.1/CORL/Util/Puppet/ResourceGroup.html +0 -964
- data/rdoc/site/0.5.1/CORL/Util/Puppet.html +0 -1131
- data/rdoc/site/0.5.1/CORL/Util.html +0 -385
- data/rdoc/site/0.5.1/CORL/Vagrant/Config.html +0 -967
- data/rdoc/site/0.5.1/CORL/Vagrant.html +0 -462
- data/rdoc/site/0.5.1/CORL.html +0 -496
- data/rdoc/site/0.5.1/Fog/Compute/AWS/Server.html +0 -467
- data/rdoc/site/0.5.1/Fog/Compute/AWS.html +0 -389
- data/rdoc/site/0.5.1/Fog/Compute/RackspaceV2/Server.html +0 -452
- data/rdoc/site/0.5.1/Fog/Compute/RackspaceV2.html +0 -389
- data/rdoc/site/0.5.1/Fog/Compute.html +0 -384
- data/rdoc/site/0.5.1/Fog.html +0 -384
- data/rdoc/site/0.5.1/Hiera/Backend.html +0 -466
- data/rdoc/site/0.5.1/Hiera/Corl_logger.html +0 -493
- data/rdoc/site/0.5.1/Hiera.html +0 -390
- data/rdoc/site/0.5.1/Nucleon/Action/Cloud/Config.html +0 -978
- data/rdoc/site/0.5.1/Nucleon/Action/Cloud/Create.html +0 -562
- data/rdoc/site/0.5.1/Nucleon/Action/Cloud/Images.html +0 -596
- data/rdoc/site/0.5.1/Nucleon/Action/Cloud/Inspect.html +0 -567
- data/rdoc/site/0.5.1/Nucleon/Action/Cloud/Machines.html +0 -591
- data/rdoc/site/0.5.1/Nucleon/Action/Cloud/Regions.html +0 -591
- data/rdoc/site/0.5.1/Nucleon/Action/Cloud/Settings.html +0 -878
- data/rdoc/site/0.5.1/Nucleon/Action/Cloud/Vagrantfile.html +0 -539
- data/rdoc/site/0.5.1/Nucleon/Action/Cloud.html +0 -390
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Authorize.html +0 -567
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Bootstrap.html +0 -628
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Build.html +0 -550
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Cache.html +0 -773
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Destroy.html +0 -597
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Exec.html +0 -554
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Fact.html +0 -733
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Facts.html +0 -505
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Group.html +0 -729
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Groups.html +0 -505
- data/rdoc/site/0.5.1/Nucleon/Action/Node/IP.html +0 -477
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Identity.html +0 -614
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Image.html +0 -597
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Keypair.html +0 -596
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Lookup.html +0 -579
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Provision.html +0 -577
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Reboot.html +0 -597
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Revoke.html +0 -565
- data/rdoc/site/0.5.1/Nucleon/Action/Node/SSH.html +0 -607
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Seed.html +0 -626
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Spawn.html +0 -699
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Start.html +0 -597
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Status.html +0 -615
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Stop.html +0 -597
- data/rdoc/site/0.5.1/Nucleon/Action/Node.html +0 -406
- data/rdoc/site/0.5.1/Nucleon/Action/Plugin/Create.html +0 -736
- data/rdoc/site/0.5.1/Nucleon/Action/Plugin/List.html +0 -570
- data/rdoc/site/0.5.1/Nucleon/Action/Plugin.html +0 -384
- data/rdoc/site/0.5.1/Nucleon/Action/Plugins.html +0 -435
- data/rdoc/site/0.5.1/Nucleon/Action.html +0 -417
- data/rdoc/site/0.5.1/Nucleon/Config.html +0 -401
- data/rdoc/site/0.5.1/Nucleon/Event/Puppet.html +0 -717
- data/rdoc/site/0.5.1/Nucleon/Event.html +0 -383
- data/rdoc/site/0.5.1/Nucleon/Plugin/Base.html +0 -389
- data/rdoc/site/0.5.1/Nucleon/Plugin/CloudAction.html +0 -894
- data/rdoc/site/0.5.1/Nucleon/Plugin.html +0 -384
- data/rdoc/site/0.5.1/Nucleon/Template/Environment.html +0 -572
- data/rdoc/site/0.5.1/Nucleon/Template.html +0 -383
- data/rdoc/site/0.5.1/Nucleon.html +0 -421
- data/rdoc/site/0.5.1/Object.html +0 -402
- data/rdoc/site/0.5.1/Puppet/DataBinding/Corl.html +0 -389
- data/rdoc/site/0.5.1/Puppet/DataBinding.html +0 -382
- data/rdoc/site/0.5.1/Puppet/Indirector/Corl.html +0 -501
- data/rdoc/site/0.5.1/Puppet/Indirector.html +0 -382
- data/rdoc/site/0.5.1/Puppet/Parser/Functions.html +0 -524
- data/rdoc/site/0.5.1/Puppet/Parser.html +0 -382
- data/rdoc/site/0.5.1/Puppet.html +0 -382
- data/rdoc/site/0.5.1/README_rdoc.html +0 -384
- data/rdoc/site/0.5.1/Vagrant/Config/Loader.html +0 -443
- data/rdoc/site/0.5.1/Vagrant/Config.html +0 -383
- data/rdoc/site/0.5.1/Vagrant/Vagrantfile.html +0 -436
- data/rdoc/site/0.5.1/Vagrant.html +0 -390
- data/rdoc/site/0.5.1/VagrantPlugins/CORL/Action/DeleteCache.html +0 -446
- data/rdoc/site/0.5.1/VagrantPlugins/CORL/Action/InitKeys.html +0 -452
- data/rdoc/site/0.5.1/VagrantPlugins/CORL/Action/LinkNetwork.html +0 -450
- data/rdoc/site/0.5.1/VagrantPlugins/CORL/Action.html +0 -385
- data/rdoc/site/0.5.1/VagrantPlugins/CORL/BaseAction.html +0 -535
- data/rdoc/site/0.5.1/VagrantPlugins/CORL/Command/Launcher.html +0 -577
- data/rdoc/site/0.5.1/VagrantPlugins/CORL/Command.html +0 -383
- data/rdoc/site/0.5.1/VagrantPlugins/CORL/Config/CORL.html +0 -776
- data/rdoc/site/0.5.1/VagrantPlugins/CORL/Config.html +0 -383
- data/rdoc/site/0.5.1/VagrantPlugins/CORL/Plugin.html +0 -389
- data/rdoc/site/0.5.1/VagrantPlugins/CORL/Provisioner/CORL.html +0 -580
- data/rdoc/site/0.5.1/VagrantPlugins/CORL/Provisioner.html +0 -383
- data/rdoc/site/0.5.1/VagrantPlugins/CORL.html +0 -390
- data/rdoc/site/0.5.1/VagrantPlugins.html +0 -390
- data/rdoc/site/0.5.1/created.rid +0 -114
- data/rdoc/site/0.5.1/images/add.png +0 -0
- data/rdoc/site/0.5.1/images/brick.png +0 -0
- data/rdoc/site/0.5.1/images/brick_link.png +0 -0
- data/rdoc/site/0.5.1/images/bug.png +0 -0
- data/rdoc/site/0.5.1/images/bullet_black.png +0 -0
- data/rdoc/site/0.5.1/images/bullet_toggle_minus.png +0 -0
- data/rdoc/site/0.5.1/images/bullet_toggle_plus.png +0 -0
- data/rdoc/site/0.5.1/images/date.png +0 -0
- data/rdoc/site/0.5.1/images/delete.png +0 -0
- data/rdoc/site/0.5.1/images/find.png +0 -0
- data/rdoc/site/0.5.1/images/loadingAnimation.gif +0 -0
- data/rdoc/site/0.5.1/images/macFFBgHack.png +0 -0
- data/rdoc/site/0.5.1/images/package.png +0 -0
- data/rdoc/site/0.5.1/images/page_green.png +0 -0
- data/rdoc/site/0.5.1/images/page_white_text.png +0 -0
- data/rdoc/site/0.5.1/images/page_white_width.png +0 -0
- data/rdoc/site/0.5.1/images/plugin.png +0 -0
- data/rdoc/site/0.5.1/images/ruby.png +0 -0
- data/rdoc/site/0.5.1/images/tag_blue.png +0 -0
- data/rdoc/site/0.5.1/images/tag_green.png +0 -0
- data/rdoc/site/0.5.1/images/transparent.png +0 -0
- data/rdoc/site/0.5.1/images/wrench.png +0 -0
- data/rdoc/site/0.5.1/images/wrench_orange.png +0 -0
- data/rdoc/site/0.5.1/images/zoom.png +0 -0
- data/rdoc/site/0.5.1/index.html +0 -383
- data/rdoc/site/0.5.1/js/darkfish.js +0 -155
- data/rdoc/site/0.5.1/js/jquery.js +0 -18
- data/rdoc/site/0.5.1/js/navigation.js +0 -142
- data/rdoc/site/0.5.1/js/search.js +0 -94
- data/rdoc/site/0.5.1/js/search_index.js +0 -1
- data/rdoc/site/0.5.1/js/searcher.js +0 -228
- data/rdoc/site/0.5.1/rdoc.css +0 -543
- data/rdoc/site/0.5.1/table_of_contents.html +0 -2005
- data/spec/corl_mock_input.rb +0 -29
- data/spec/corl_test_kernel.rb +0 -22
data/lib/core/plugin/node.rb
CHANGED
|
@@ -2,27 +2,27 @@
|
|
|
2
2
|
module CORL
|
|
3
3
|
module Plugin
|
|
4
4
|
class Node < Nucleon.plugin_class(:nucleon, :base)
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
include Parallel
|
|
7
7
|
external_block_exec :exec, :command, :action
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
#-----------------------------------------------------------------------------
|
|
10
10
|
# Node plugin interface
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
def normalize(reload)
|
|
13
13
|
super
|
|
14
|
-
|
|
14
|
+
|
|
15
15
|
@class_color = :purple
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
export.each do |name, value|
|
|
18
18
|
myself[name] = value
|
|
19
19
|
end
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
ui.resource = Util::Console.colorize(hostname, @class_color)
|
|
22
22
|
logger = hostname
|
|
23
|
-
|
|
23
|
+
|
|
24
24
|
add_groups([ "all", plugin_provider.to_s, plugin_name.to_s ])
|
|
25
|
-
|
|
25
|
+
|
|
26
26
|
unless reload
|
|
27
27
|
@cli_interface = Util::Liquid.new do |method, args, &code|
|
|
28
28
|
result = exec({ :commands => [ [ method, args ].flatten.join(' ') ] }) do |op, data|
|
|
@@ -34,7 +34,7 @@ class Node < Nucleon.plugin_class(:nucleon, :base)
|
|
|
34
34
|
end
|
|
35
35
|
result
|
|
36
36
|
end
|
|
37
|
-
|
|
37
|
+
|
|
38
38
|
@action_interface = Util::Liquid.new do |method, args, &code|
|
|
39
39
|
action(method, *args) do |op, data|
|
|
40
40
|
code.call(op, data) if code
|
|
@@ -42,190 +42,197 @@ class Node < Nucleon.plugin_class(:nucleon, :base)
|
|
|
42
42
|
end
|
|
43
43
|
end
|
|
44
44
|
end
|
|
45
|
-
|
|
45
|
+
|
|
46
46
|
#---
|
|
47
|
-
|
|
48
|
-
def method_missing(method, *args, &code)
|
|
47
|
+
|
|
48
|
+
def method_missing(method, *args, &code)
|
|
49
49
|
action(method, *args) do |op, data|
|
|
50
50
|
code.call(op, data) if code
|
|
51
51
|
end
|
|
52
52
|
end
|
|
53
|
-
|
|
53
|
+
|
|
54
54
|
#---
|
|
55
|
-
|
|
55
|
+
|
|
56
56
|
def localize
|
|
57
57
|
@local_context = true
|
|
58
58
|
myself.local_machine = create_machine(:local_machine, :physical)
|
|
59
59
|
end
|
|
60
|
-
|
|
60
|
+
|
|
61
61
|
#---
|
|
62
|
-
|
|
62
|
+
|
|
63
63
|
def remove_plugin
|
|
64
64
|
CORL.remove_plugin(local_machine) if local_machine
|
|
65
65
|
CORL.remove_plugin(machine) if machine
|
|
66
66
|
end
|
|
67
|
-
|
|
67
|
+
|
|
68
68
|
#-----------------------------------------------------------------------------
|
|
69
69
|
# Checks
|
|
70
|
-
|
|
70
|
+
|
|
71
|
+
def running?
|
|
72
|
+
return machine.running? if machine
|
|
73
|
+
false
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
#---
|
|
77
|
+
|
|
71
78
|
def local?
|
|
72
79
|
@local_context ? true : false
|
|
73
80
|
end
|
|
74
|
-
|
|
81
|
+
|
|
75
82
|
#---
|
|
76
|
-
|
|
83
|
+
|
|
77
84
|
def usable_image?(image)
|
|
78
85
|
true
|
|
79
|
-
end
|
|
80
|
-
|
|
86
|
+
end
|
|
87
|
+
|
|
81
88
|
#-----------------------------------------------------------------------------
|
|
82
89
|
# Property accessors / modifiers
|
|
83
|
-
|
|
90
|
+
|
|
84
91
|
network_settings :node
|
|
85
|
-
|
|
92
|
+
|
|
86
93
|
#---
|
|
87
|
-
|
|
94
|
+
|
|
88
95
|
def keypair
|
|
89
96
|
@keypair
|
|
90
97
|
end
|
|
91
|
-
|
|
98
|
+
|
|
92
99
|
def keypair=keypair
|
|
93
100
|
@keypair = keypair
|
|
94
101
|
end
|
|
95
|
-
|
|
102
|
+
|
|
96
103
|
#---
|
|
97
|
-
|
|
104
|
+
|
|
98
105
|
def machine
|
|
99
106
|
@machine
|
|
100
107
|
end
|
|
101
|
-
|
|
108
|
+
|
|
102
109
|
def machine=machine
|
|
103
|
-
@machine = machine
|
|
110
|
+
@machine = machine
|
|
104
111
|
end
|
|
105
|
-
|
|
112
|
+
|
|
106
113
|
#---
|
|
107
|
-
|
|
114
|
+
|
|
108
115
|
def local_machine
|
|
109
116
|
@local_machine
|
|
110
117
|
end
|
|
111
|
-
|
|
118
|
+
|
|
112
119
|
def local_machine=local_machine
|
|
113
|
-
@local_machine = local_machine
|
|
120
|
+
@local_machine = local_machine
|
|
114
121
|
end
|
|
115
|
-
|
|
122
|
+
|
|
116
123
|
#---
|
|
117
|
-
|
|
124
|
+
|
|
118
125
|
def id(reset = false)
|
|
119
126
|
myself[:id] = machine.plugin_name if machine && ( reset || setting(:id).nil? )
|
|
120
127
|
setting(:id)
|
|
121
128
|
end
|
|
122
|
-
|
|
129
|
+
|
|
123
130
|
#---
|
|
124
|
-
|
|
131
|
+
|
|
125
132
|
def public_ip(reset = false)
|
|
126
133
|
myself[:public_ip] = machine.public_ip if machine && ( reset || setting(:public_ip).nil? )
|
|
127
134
|
setting(:public_ip)
|
|
128
135
|
end
|
|
129
|
-
|
|
136
|
+
|
|
130
137
|
def private_ip(reset = false)
|
|
131
138
|
myself[:private_ip] = machine.private_ip if machine && ( reset || setting(:private_ip).nil? )
|
|
132
139
|
setting(:private_ip)
|
|
133
140
|
end
|
|
134
|
-
|
|
141
|
+
|
|
135
142
|
#---
|
|
136
|
-
|
|
143
|
+
|
|
137
144
|
def hostname
|
|
138
145
|
hostname = setting(:hostname)
|
|
139
|
-
|
|
146
|
+
|
|
140
147
|
unless hostname
|
|
141
148
|
hostname = plugin_name
|
|
142
149
|
end
|
|
143
|
-
|
|
144
|
-
if hostname.to_s != ui.resource.to_s
|
|
150
|
+
|
|
151
|
+
if hostname.to_s != ui.resource.to_s
|
|
145
152
|
ui.resource = Util::Console.colorize(hostname, @class_color)
|
|
146
153
|
logger = hostname
|
|
147
154
|
end
|
|
148
155
|
hostname
|
|
149
156
|
end
|
|
150
|
-
|
|
157
|
+
|
|
151
158
|
#---
|
|
152
|
-
|
|
159
|
+
|
|
153
160
|
def state(reset = false)
|
|
154
161
|
myself[:state] = machine.state if machine && ( reset || setting(:state).nil? )
|
|
155
162
|
setting(:state)
|
|
156
163
|
end
|
|
157
|
-
|
|
164
|
+
|
|
158
165
|
#---
|
|
159
|
-
|
|
166
|
+
|
|
160
167
|
def user=user
|
|
161
168
|
myself[:user] = user
|
|
162
169
|
end
|
|
163
|
-
|
|
170
|
+
|
|
164
171
|
def user
|
|
165
172
|
myself[:user]
|
|
166
173
|
end
|
|
167
|
-
|
|
174
|
+
|
|
168
175
|
#---
|
|
169
|
-
|
|
176
|
+
|
|
170
177
|
def ssh_port=ssh_port
|
|
171
178
|
myself[:ssh_port] = ssh_port
|
|
172
179
|
machine.init_ssh(ssh_port) if machine
|
|
173
180
|
end
|
|
174
|
-
|
|
181
|
+
|
|
175
182
|
def ssh_port
|
|
176
183
|
myself[:ssh_port] = 22 if myself[:ssh_port].nil?
|
|
177
184
|
myself[:ssh_port]
|
|
178
185
|
end
|
|
179
|
-
|
|
186
|
+
|
|
180
187
|
#---
|
|
181
|
-
|
|
188
|
+
|
|
182
189
|
def home(env_var = 'HOME', reset = false)
|
|
183
190
|
if reset || myself[:user_home].nil?
|
|
184
191
|
myself[:user_home] = cli_capture(:echo, '$' + env_var.to_s.gsub('$', '')) if machine
|
|
185
192
|
end
|
|
186
193
|
myself[:user_home]
|
|
187
194
|
end
|
|
188
|
-
|
|
195
|
+
|
|
189
196
|
#---
|
|
190
|
-
|
|
197
|
+
|
|
191
198
|
def ssh_path(home_env_var = 'HOME', reset = false)
|
|
192
199
|
home = home(home_env_var, reset)
|
|
193
200
|
home ? File.join(home, '.ssh') : nil
|
|
194
201
|
end
|
|
195
|
-
|
|
202
|
+
|
|
196
203
|
#---
|
|
197
|
-
|
|
204
|
+
|
|
198
205
|
def private_key=private_key
|
|
199
206
|
myself[:private_key] = private_key
|
|
200
207
|
end
|
|
201
|
-
|
|
208
|
+
|
|
202
209
|
def private_key
|
|
203
210
|
config_key = myself[:private_key]
|
|
204
211
|
return File.expand_path(config_key, network.directory) if config_key
|
|
205
212
|
nil
|
|
206
213
|
end
|
|
207
|
-
|
|
214
|
+
|
|
208
215
|
#---
|
|
209
|
-
|
|
216
|
+
|
|
210
217
|
def public_key=public_key
|
|
211
218
|
myself[:public_key] = public_key
|
|
212
219
|
end
|
|
213
|
-
|
|
220
|
+
|
|
214
221
|
def public_key
|
|
215
222
|
config_key = myself[:public_key]
|
|
216
223
|
return File.expand_path(config_key, network.directory) if config_key
|
|
217
224
|
end
|
|
218
|
-
|
|
225
|
+
|
|
219
226
|
#---
|
|
220
|
-
|
|
227
|
+
|
|
221
228
|
def machine_types # Must be set at machine level (queried)
|
|
222
229
|
machine.machine_types if machine
|
|
223
230
|
end
|
|
224
|
-
|
|
231
|
+
|
|
225
232
|
def machine_type(reset = false)
|
|
226
233
|
myself[:machine_type] = machine.machine_type if machine && ( reset || myself[:machine_type].nil? )
|
|
227
234
|
machine_type = myself[:machine_type]
|
|
228
|
-
|
|
235
|
+
|
|
229
236
|
if machine_type.nil? && machine
|
|
230
237
|
if types = machine_types
|
|
231
238
|
unless types.empty?
|
|
@@ -234,41 +241,41 @@ class Node < Nucleon.plugin_class(:nucleon, :base)
|
|
|
234
241
|
end
|
|
235
242
|
end
|
|
236
243
|
end
|
|
237
|
-
|
|
244
|
+
|
|
238
245
|
machine_type
|
|
239
246
|
end
|
|
240
|
-
|
|
247
|
+
|
|
241
248
|
#---
|
|
242
|
-
|
|
249
|
+
|
|
243
250
|
def images(search_terms = [], options = {})
|
|
244
251
|
config = Config.ensure(options)
|
|
245
252
|
images = []
|
|
246
|
-
|
|
253
|
+
|
|
247
254
|
if machine
|
|
248
255
|
loaded_images = machine.images
|
|
249
|
-
|
|
256
|
+
|
|
250
257
|
if loaded_images
|
|
251
258
|
require_all = config.get(:require_all, false)
|
|
252
|
-
|
|
259
|
+
|
|
253
260
|
loaded_images.each do |image|
|
|
254
261
|
if usable_image?(image)
|
|
255
262
|
include_image = ( search_terms.empty? ? true : require_all )
|
|
256
263
|
image_text = image_search_text(image)
|
|
257
|
-
|
|
264
|
+
|
|
258
265
|
search_terms.each do |term|
|
|
259
266
|
if config.get(:match_case, false)
|
|
260
267
|
success = image_text.match(/#{term}/)
|
|
261
268
|
else
|
|
262
|
-
success = image_text.match(/#{term}/i)
|
|
269
|
+
success = image_text.match(/#{term}/i)
|
|
263
270
|
end
|
|
264
|
-
|
|
265
|
-
if require_all
|
|
271
|
+
|
|
272
|
+
if require_all
|
|
266
273
|
include_image = false unless success
|
|
267
274
|
else
|
|
268
|
-
include_image = true if success
|
|
275
|
+
include_image = true if success
|
|
269
276
|
end
|
|
270
277
|
end
|
|
271
|
-
|
|
278
|
+
|
|
272
279
|
images << image if include_image
|
|
273
280
|
end
|
|
274
281
|
end
|
|
@@ -276,133 +283,151 @@ class Node < Nucleon.plugin_class(:nucleon, :base)
|
|
|
276
283
|
end
|
|
277
284
|
images
|
|
278
285
|
end
|
|
279
|
-
|
|
286
|
+
|
|
280
287
|
#---
|
|
281
|
-
|
|
288
|
+
|
|
282
289
|
def image=image
|
|
283
290
|
myself[:image] = image
|
|
284
291
|
end
|
|
285
|
-
|
|
292
|
+
|
|
286
293
|
def image(reset = false)
|
|
287
294
|
myself[:image] = machine.image if machine && ( reset || myself[:image].nil? )
|
|
288
295
|
myself[:image]
|
|
289
296
|
end
|
|
290
|
-
|
|
297
|
+
|
|
291
298
|
#---
|
|
292
|
-
|
|
299
|
+
|
|
293
300
|
def custom_facts=facts
|
|
294
301
|
myself[:facts] = hash(facts)
|
|
295
302
|
end
|
|
296
|
-
|
|
303
|
+
|
|
297
304
|
def custom_facts
|
|
298
305
|
search(:facts, {}, :hash)
|
|
299
306
|
end
|
|
300
|
-
|
|
307
|
+
|
|
301
308
|
def ensure_custom_facts(facts)
|
|
302
309
|
hash(facts).each do |name, value|
|
|
303
310
|
set_setting([ :facts, name ], value)
|
|
304
311
|
end
|
|
305
312
|
end
|
|
306
|
-
|
|
313
|
+
|
|
307
314
|
def remove_custom_facts(*facts)
|
|
308
315
|
facts.each do |name|
|
|
309
316
|
delete_setting([ :facts, name ])
|
|
310
|
-
end
|
|
317
|
+
end
|
|
311
318
|
end
|
|
312
|
-
|
|
319
|
+
|
|
313
320
|
#---
|
|
314
|
-
|
|
321
|
+
|
|
315
322
|
def profiles=profiles
|
|
316
323
|
myself[:profiles] = array(profiles)
|
|
317
324
|
end
|
|
318
|
-
|
|
325
|
+
|
|
319
326
|
def profiles
|
|
320
327
|
[ array(myself[:profiles]), lookup_array(:profiles).reverse ].flatten
|
|
321
328
|
end
|
|
322
|
-
|
|
329
|
+
|
|
323
330
|
#---
|
|
324
|
-
|
|
331
|
+
|
|
325
332
|
def provisioner_info
|
|
326
333
|
provisioner_info = {}
|
|
327
|
-
|
|
334
|
+
|
|
328
335
|
# Compose needed provisioners and profiles
|
|
329
336
|
profiles.each do |profile|
|
|
330
337
|
if info = Plugin::Provisioner.translate_reference(profile)
|
|
331
338
|
provider = info[:provider]
|
|
332
|
-
|
|
339
|
+
|
|
333
340
|
provisioner_info[provider] = { :profiles => [] } unless provisioner_info.has_key?(provider)
|
|
334
341
|
provisioner_info[provider][:profiles] += info[:profiles]
|
|
335
342
|
end
|
|
336
343
|
end
|
|
337
344
|
provisioner_info
|
|
338
345
|
end
|
|
339
|
-
|
|
346
|
+
|
|
340
347
|
#---
|
|
341
|
-
|
|
348
|
+
|
|
342
349
|
def provisioners
|
|
343
|
-
provisioners = {}
|
|
350
|
+
provisioners = {}
|
|
344
351
|
provisioner_info.each do |provider, node_profiles|
|
|
345
352
|
provisioners[provider] = network.provisioners(provider)
|
|
346
|
-
end
|
|
353
|
+
end
|
|
347
354
|
provisioners
|
|
348
355
|
end
|
|
349
|
-
|
|
356
|
+
|
|
350
357
|
#---
|
|
351
|
-
|
|
358
|
+
|
|
352
359
|
def build_time=time
|
|
353
360
|
myself[:build] = time
|
|
354
361
|
end
|
|
355
|
-
|
|
362
|
+
|
|
356
363
|
def build_time
|
|
357
364
|
myself[:build]
|
|
358
365
|
end
|
|
359
|
-
|
|
366
|
+
|
|
360
367
|
#---
|
|
361
|
-
|
|
368
|
+
|
|
362
369
|
def bootstrap_script=bootstrap
|
|
363
370
|
myself[:bootstrap] = bootstrap
|
|
364
371
|
end
|
|
365
|
-
|
|
372
|
+
|
|
366
373
|
def bootstrap_script
|
|
367
|
-
myself[:bootstrap]
|
|
374
|
+
myself[:bootstrap]
|
|
375
|
+
end
|
|
376
|
+
|
|
377
|
+
#---
|
|
378
|
+
|
|
379
|
+
def agents
|
|
380
|
+
hash(myself[:agents])
|
|
368
381
|
end
|
|
369
|
-
|
|
382
|
+
|
|
383
|
+
def agent(provider)
|
|
384
|
+
search([ :agents, provider ], {}, :hash)
|
|
385
|
+
end
|
|
386
|
+
|
|
387
|
+
def add_agent(provider, settings)
|
|
388
|
+
set_setting([ :agents, provider ], Config.new(settings).export)
|
|
389
|
+
end
|
|
390
|
+
|
|
391
|
+
def remove_agent(provider)
|
|
392
|
+
delete_setting([ :agents, provider ])
|
|
393
|
+
end
|
|
394
|
+
|
|
370
395
|
#-----------------------------------------------------------------------------
|
|
371
396
|
# Settings groups
|
|
372
|
-
|
|
397
|
+
|
|
373
398
|
def machine_config
|
|
374
399
|
name = setting(:id)
|
|
375
400
|
name = nil if name.nil? || name.empty?
|
|
376
401
|
config = Config.new({ :name => name })
|
|
377
|
-
|
|
402
|
+
|
|
378
403
|
yield(config) if block_given?
|
|
379
404
|
config
|
|
380
405
|
end
|
|
381
|
-
|
|
406
|
+
|
|
382
407
|
#-----------------------------------------------------------------------------
|
|
383
408
|
# Machine information
|
|
384
|
-
|
|
409
|
+
|
|
385
410
|
def fact_var
|
|
386
411
|
@facts
|
|
387
412
|
end
|
|
388
|
-
|
|
413
|
+
|
|
389
414
|
def fact_var=facts
|
|
390
415
|
@facts = facts
|
|
391
416
|
end
|
|
392
|
-
|
|
417
|
+
|
|
393
418
|
#---
|
|
394
|
-
|
|
419
|
+
|
|
395
420
|
def facts(reset = false, clone = true)
|
|
396
421
|
if reset || fact_var.nil?
|
|
397
422
|
default_facts = extended_config(:hiera_default_facts, {
|
|
398
|
-
:fqdn => hostname,
|
|
423
|
+
:fqdn => hostname,
|
|
399
424
|
:hostname => hostname.gsub(/\..*$/, ''),
|
|
400
425
|
:corl_provider => plugin_provider.to_s
|
|
401
426
|
})
|
|
402
|
-
|
|
427
|
+
|
|
403
428
|
unless local?
|
|
404
429
|
result = run.node_facts({ :quiet => true })
|
|
405
|
-
|
|
430
|
+
|
|
406
431
|
if result.status == code.success
|
|
407
432
|
node_facts = Util::Data.symbol_map(Util::Data.parse_json(result.errors))
|
|
408
433
|
end
|
|
@@ -410,15 +435,15 @@ class Node < Nucleon.plugin_class(:nucleon, :base)
|
|
|
410
435
|
unless node_facts
|
|
411
436
|
node_facts = local? ? Util::Data.merge([ CORL.facts, custom_facts ]) : custom_facts
|
|
412
437
|
end
|
|
413
|
-
|
|
438
|
+
|
|
414
439
|
self.fact_var = Config.new(node_facts).defaults(default_facts).export
|
|
415
440
|
end
|
|
416
441
|
return fact_var.clone if clone
|
|
417
442
|
fact_var
|
|
418
443
|
end
|
|
419
|
-
|
|
444
|
+
|
|
420
445
|
#---
|
|
421
|
-
|
|
446
|
+
|
|
422
447
|
def create_facts_post(data, names)
|
|
423
448
|
fact_values = {}
|
|
424
449
|
names.each do |name|
|
|
@@ -428,197 +453,197 @@ class Node < Nucleon.plugin_class(:nucleon, :base)
|
|
|
428
453
|
ensure_custom_facts(fact_values)
|
|
429
454
|
data
|
|
430
455
|
end
|
|
431
|
-
|
|
456
|
+
|
|
432
457
|
#---
|
|
433
|
-
|
|
458
|
+
|
|
434
459
|
def delete_facts_post(data, old_data)
|
|
435
460
|
remove_custom_facts(*old_data.keys)
|
|
436
461
|
data
|
|
437
462
|
end
|
|
438
|
-
|
|
463
|
+
|
|
439
464
|
#---
|
|
440
|
-
|
|
465
|
+
|
|
441
466
|
def hiera_var
|
|
442
467
|
@hiera
|
|
443
468
|
end
|
|
444
|
-
|
|
469
|
+
|
|
445
470
|
def hiera_var=hiera
|
|
446
471
|
@hiera = hiera
|
|
447
472
|
end
|
|
448
|
-
|
|
473
|
+
|
|
449
474
|
#---
|
|
450
|
-
|
|
475
|
+
|
|
451
476
|
def hiera_override_dir
|
|
452
477
|
network.hiera_override_dir
|
|
453
478
|
end
|
|
454
|
-
|
|
479
|
+
|
|
455
480
|
#---
|
|
456
|
-
|
|
481
|
+
|
|
457
482
|
def lookup(property, default = nil, options = {})
|
|
458
483
|
unless local?
|
|
459
484
|
config = Config.ensure(options).import({ :property => property, :quiet => true })
|
|
460
485
|
result = run.node_lookup(config)
|
|
461
|
-
|
|
486
|
+
|
|
462
487
|
if result.status == code.success
|
|
463
488
|
return Util::Data.value(Util::Data.parse_json(result.errors), default)
|
|
464
489
|
end
|
|
465
490
|
return default
|
|
466
491
|
end
|
|
467
492
|
options[:hiera_scope] = Util::Data.prefix('::', facts, '')
|
|
468
|
-
lookup_base(property, default, options)
|
|
493
|
+
lookup_base(property, default, options)
|
|
469
494
|
end
|
|
470
|
-
|
|
495
|
+
|
|
471
496
|
#---
|
|
472
|
-
|
|
497
|
+
|
|
473
498
|
def remote_cache_setting(keys, default = nil, format = false)
|
|
474
|
-
cache_id = keys.flatten.join('.')
|
|
499
|
+
cache_id = keys.flatten.join('.')
|
|
475
500
|
result = run.node_cache({ :name => cache_id })
|
|
476
|
-
|
|
501
|
+
|
|
477
502
|
if result.status == code.success
|
|
478
503
|
value = Util::Data.value(Util::Data.parse_json(result.errors), default)
|
|
479
504
|
else
|
|
480
505
|
value = default
|
|
481
|
-
end
|
|
506
|
+
end
|
|
482
507
|
filter(value, format)
|
|
483
508
|
end
|
|
484
|
-
|
|
509
|
+
|
|
485
510
|
#---
|
|
486
511
|
|
|
487
512
|
def set_remote_cache_setting(keys, value)
|
|
488
|
-
run.node_cache({
|
|
489
|
-
:name => keys.flatten.join('.'),
|
|
490
|
-
:value => Util::Data.to_json(value, false),
|
|
491
|
-
:json => true
|
|
513
|
+
run.node_cache({
|
|
514
|
+
:name => keys.flatten.join('.'),
|
|
515
|
+
:value => Util::Data.to_json(value, false),
|
|
516
|
+
:json => true
|
|
492
517
|
}).status == code.success
|
|
493
518
|
end
|
|
494
|
-
|
|
519
|
+
|
|
495
520
|
#---
|
|
496
521
|
|
|
497
522
|
def delete_remote_cache_setting(keys)
|
|
498
|
-
run.node_cache({
|
|
499
|
-
:name => keys.flatten.join('.'),
|
|
500
|
-
:delete => true
|
|
523
|
+
run.node_cache({
|
|
524
|
+
:name => keys.flatten.join('.'),
|
|
525
|
+
:delete => true
|
|
501
526
|
}).status == code.success
|
|
502
527
|
end
|
|
503
|
-
|
|
528
|
+
|
|
504
529
|
#---
|
|
505
530
|
|
|
506
531
|
def clear_remote_cache
|
|
507
532
|
run.node_cache({ :clear => true }).status == code.success
|
|
508
533
|
end
|
|
509
|
-
|
|
534
|
+
|
|
510
535
|
#-----------------------------------------------------------------------------
|
|
511
536
|
# Machine operations
|
|
512
|
-
|
|
537
|
+
|
|
513
538
|
def build(options = {})
|
|
514
539
|
config = Config.ensure(options)
|
|
515
540
|
success = true
|
|
516
|
-
|
|
541
|
+
|
|
517
542
|
# TODO: Figure out what's going on with the parallel implementation here.
|
|
518
543
|
parallel_original = ENV['NUCLEON_NO_PARALLEL']
|
|
519
544
|
ENV['NUCLEON_NO_PARALLEL'] = 'true'
|
|
520
|
-
|
|
545
|
+
|
|
521
546
|
status = parallel(:build_provider, network.builders, config)
|
|
522
547
|
success = false if status.values.include?(false)
|
|
523
|
-
|
|
548
|
+
|
|
524
549
|
if success
|
|
525
550
|
status = parallel(:build_provisioners, provisioners, config)
|
|
526
551
|
success = false if status.values.include?(false)
|
|
527
|
-
|
|
552
|
+
|
|
528
553
|
if success
|
|
529
554
|
myself.build_time = Time.now.to_s if success
|
|
530
|
-
|
|
555
|
+
|
|
531
556
|
if config.delete(:save, true)
|
|
532
|
-
success("Saving successful build", { :i18n => false })
|
|
533
|
-
|
|
557
|
+
success("Saving successful build", { :i18n => false })
|
|
558
|
+
|
|
534
559
|
success = save(extended_config(:build, {
|
|
535
560
|
:message => config.get(:message, "Built #{plugin_provider} node: #{plugin_name}"),
|
|
536
|
-
:remote => config.get(:remote, :edit)
|
|
561
|
+
:remote => config.get(:remote, :edit)
|
|
537
562
|
}))
|
|
538
563
|
end
|
|
539
564
|
end
|
|
540
565
|
end
|
|
541
|
-
|
|
542
|
-
ENV['NUCLEON_NO_PARALLEL'] = parallel_original
|
|
566
|
+
|
|
567
|
+
ENV['NUCLEON_NO_PARALLEL'] = parallel_original
|
|
543
568
|
success
|
|
544
569
|
end
|
|
545
|
-
|
|
570
|
+
|
|
546
571
|
def build_provider(provider, plugin, config)
|
|
547
572
|
info("Building #{provider} components", { :i18n => false })
|
|
548
573
|
plugin.build(myself, config)
|
|
549
574
|
end
|
|
550
|
-
|
|
575
|
+
|
|
551
576
|
def build_provisioners(provider, collection, config)
|
|
552
577
|
info("Building #{provider} provisioner collection", { :i18n => false })
|
|
553
578
|
status = parallel(:build_provisioner, collection, provider, config)
|
|
554
|
-
status.values.include?(false) ? false : true
|
|
579
|
+
status.values.include?(false) ? false : true
|
|
555
580
|
end
|
|
556
|
-
|
|
581
|
+
|
|
557
582
|
def build_provisioner(name, plugin, provider, config)
|
|
558
583
|
info("Building #{provider} #{name} provisioner components", { :i18n => false })
|
|
559
|
-
plugin.build(myself, config)
|
|
584
|
+
plugin.build(myself, config)
|
|
560
585
|
end
|
|
561
|
-
|
|
586
|
+
|
|
562
587
|
#---
|
|
563
|
-
|
|
588
|
+
|
|
564
589
|
def attach_keys(keypair)
|
|
565
590
|
base_name = "#{plugin_provider}-#{plugin_name}"
|
|
566
|
-
save_config = {
|
|
567
|
-
:pull => false,
|
|
591
|
+
save_config = {
|
|
592
|
+
:pull => false,
|
|
568
593
|
:push => false,
|
|
569
|
-
:message => "Updating SSH keys for node #{plugin_provider} (#{plugin_name})"
|
|
594
|
+
:message => "Updating SSH keys for node #{plugin_provider} (#{plugin_name})"
|
|
570
595
|
}
|
|
571
|
-
|
|
596
|
+
|
|
572
597
|
active = machine && machine.running?
|
|
573
598
|
result = run.authorize({ :public_key => keypair.ssh_key }) if active
|
|
574
599
|
success = false
|
|
575
|
-
|
|
576
|
-
if ! active || result.status == code.success
|
|
600
|
+
|
|
601
|
+
if ! active || result.status == code.success
|
|
577
602
|
private_key = network.attach_data(:keys, "#{base_name}-id_#{keypair.type}", keypair.encrypted_key)
|
|
578
603
|
public_key = network.attach_data(:keys, "#{base_name}-id_#{keypair.type}.pub", keypair.ssh_key)
|
|
579
|
-
|
|
604
|
+
|
|
580
605
|
if private_key && public_key
|
|
581
606
|
FileUtils.chmod(0600, private_key)
|
|
582
607
|
FileUtils.chmod(0644, public_key)
|
|
583
|
-
|
|
608
|
+
|
|
584
609
|
myself.keypair = Util::SSH.generate({ :private_key => keypair.private_key })
|
|
585
610
|
myself.keypair.store(network.key_cache_directory, plugin_name)
|
|
586
|
-
|
|
611
|
+
|
|
587
612
|
save_config[:files] = [ private_key, public_key ]
|
|
588
|
-
|
|
613
|
+
|
|
589
614
|
myself.private_key = private_key
|
|
590
615
|
myself.public_key = public_key
|
|
591
|
-
|
|
616
|
+
|
|
592
617
|
success = save(extended_config(:key_save, save_config))
|
|
593
618
|
end
|
|
594
619
|
end
|
|
595
620
|
success
|
|
596
621
|
end
|
|
597
|
-
|
|
622
|
+
|
|
598
623
|
#---
|
|
599
|
-
|
|
624
|
+
|
|
600
625
|
def delete_keys
|
|
601
626
|
private_key = myself[:private_key]
|
|
602
627
|
public_key = myself[:public_key]
|
|
603
|
-
|
|
628
|
+
|
|
604
629
|
keys = []
|
|
605
630
|
keys << private_key if private_key
|
|
606
631
|
keys << public_key if public_key
|
|
607
|
-
|
|
632
|
+
|
|
608
633
|
success = true
|
|
609
|
-
|
|
634
|
+
|
|
610
635
|
unless keys.empty?
|
|
611
636
|
files = network.delete_attachments(keys)
|
|
612
|
-
|
|
637
|
+
|
|
613
638
|
if files && ! files.empty?
|
|
614
639
|
delete_setting(:private_key)
|
|
615
640
|
delete_setting(:public_key)
|
|
616
|
-
|
|
641
|
+
|
|
617
642
|
success = save(extended_config(:key_delete, {
|
|
618
|
-
:files => [ private_key, public_key ],
|
|
619
|
-
:pull => false,
|
|
643
|
+
:files => [ private_key, public_key ],
|
|
644
|
+
:pull => false,
|
|
620
645
|
:push => false,
|
|
621
|
-
:message => "Removing SSH keys for node #{plugin_provider} (#{plugin_name})"
|
|
646
|
+
:message => "Removing SSH keys for node #{plugin_provider} (#{plugin_name})"
|
|
622
647
|
}))
|
|
623
648
|
else
|
|
624
649
|
success = false
|
|
@@ -626,34 +651,34 @@ class Node < Nucleon.plugin_class(:nucleon, :base)
|
|
|
626
651
|
end
|
|
627
652
|
success
|
|
628
653
|
end
|
|
629
|
-
|
|
654
|
+
|
|
630
655
|
#---
|
|
631
|
-
|
|
656
|
+
|
|
632
657
|
def create_machine(name, provider, options = {})
|
|
633
658
|
CORL.create_plugin(:CORL, :machine, provider, extended_config(name, options).import({ :meta => { :parent => myself }}))
|
|
634
659
|
end
|
|
635
|
-
|
|
660
|
+
|
|
636
661
|
#---
|
|
637
|
-
|
|
662
|
+
|
|
638
663
|
def create(options = {})
|
|
639
664
|
success = true
|
|
640
|
-
|
|
665
|
+
|
|
641
666
|
if machine
|
|
642
667
|
config = Config.ensure(options)
|
|
643
|
-
|
|
668
|
+
|
|
644
669
|
clear_cache
|
|
645
|
-
|
|
670
|
+
|
|
646
671
|
if extension_check(:create, { :config => config })
|
|
647
672
|
logger.info("Creating node: #{plugin_name}")
|
|
648
|
-
|
|
649
|
-
yield(:config, config) if block_given?
|
|
673
|
+
|
|
674
|
+
yield(:config, config) if block_given?
|
|
650
675
|
success = machine.create(config.export)
|
|
651
|
-
|
|
676
|
+
|
|
652
677
|
if success && block_given?
|
|
653
678
|
process_success = yield(:process, config)
|
|
654
|
-
success = process_success if process_success == false
|
|
679
|
+
success = process_success if process_success == false
|
|
655
680
|
end
|
|
656
|
-
|
|
681
|
+
|
|
657
682
|
if success
|
|
658
683
|
extension(:create_success, { :config => config })
|
|
659
684
|
end
|
|
@@ -663,35 +688,36 @@ class Node < Nucleon.plugin_class(:nucleon, :base)
|
|
|
663
688
|
end
|
|
664
689
|
success
|
|
665
690
|
end
|
|
666
|
-
|
|
691
|
+
|
|
667
692
|
#---
|
|
668
|
-
|
|
693
|
+
|
|
669
694
|
def download(remote_path, local_path, options = {})
|
|
670
695
|
success = false
|
|
671
|
-
|
|
696
|
+
|
|
672
697
|
if machine && machine.running?
|
|
673
698
|
config = Config.ensure(options)
|
|
674
699
|
hook_config = Config.new({ :local_path => local_path, :remote_path => remote_path, :config => config })
|
|
675
|
-
|
|
700
|
+
quiet = config.get(:quiet, false)
|
|
701
|
+
|
|
676
702
|
if extension_check(:download, hook_config)
|
|
677
703
|
logger.info("Downloading from #{plugin_name}")
|
|
678
|
-
|
|
679
|
-
info("Starting download of #{remote_path} to #{local_path}", { :i18n => false })
|
|
704
|
+
|
|
705
|
+
info("Starting download of #{remote_path} to #{local_path}", { :i18n => false }) unless quiet
|
|
680
706
|
yield(:config, hook_config) if block_given?
|
|
681
|
-
|
|
707
|
+
|
|
682
708
|
active_machine = local? ? local_machine : machine
|
|
683
|
-
|
|
709
|
+
|
|
684
710
|
success = active_machine.download(remote_path, local_path, config.export) do |name, received, total|
|
|
685
|
-
info("#{name}: Sent #{received} of #{total}", { :i18n => false })
|
|
711
|
+
info("#{name}: Sent #{received} of #{total}", { :i18n => false }) unless quiet
|
|
686
712
|
yield(:progress, { :name => name, :received => received, :total => total })
|
|
687
713
|
end
|
|
688
|
-
|
|
714
|
+
|
|
689
715
|
if success && block_given?
|
|
690
|
-
info("Successfully finished download of #{remote_path} to #{local_path}", { :i18n => false })
|
|
716
|
+
info("Successfully finished download of #{remote_path} to #{local_path}", { :i18n => false }) unless quiet
|
|
691
717
|
process_success = yield(:process, hook_config)
|
|
692
|
-
success = process_success if process_success == false
|
|
718
|
+
success = process_success if process_success == false
|
|
693
719
|
end
|
|
694
|
-
|
|
720
|
+
|
|
695
721
|
if success
|
|
696
722
|
extension(:download_success, hook_config)
|
|
697
723
|
end
|
|
@@ -701,35 +727,36 @@ class Node < Nucleon.plugin_class(:nucleon, :base)
|
|
|
701
727
|
end
|
|
702
728
|
success
|
|
703
729
|
end
|
|
704
|
-
|
|
730
|
+
|
|
705
731
|
#---
|
|
706
|
-
|
|
732
|
+
|
|
707
733
|
def upload(local_path, remote_path, options = {})
|
|
708
734
|
success = false
|
|
709
|
-
|
|
735
|
+
|
|
710
736
|
if machine && machine.running?
|
|
711
737
|
config = Config.ensure(options)
|
|
712
738
|
hook_config = Config.new({ :local_path => local_path, :remote_path => remote_path, :config => config })
|
|
713
|
-
|
|
739
|
+
quiet = config.get(:quiet, false)
|
|
740
|
+
|
|
714
741
|
if extension_check(:upload, hook_config)
|
|
715
742
|
logger.info("Uploading to #{plugin_name}")
|
|
716
|
-
|
|
717
|
-
info("Starting upload of #{local_path} to #{remote_path}", { :i18n => false })
|
|
743
|
+
|
|
744
|
+
info("Starting upload of #{local_path} to #{remote_path}", { :i18n => false }) unless quiet
|
|
718
745
|
yield(:config, hook_config) if block_given?
|
|
719
|
-
|
|
746
|
+
|
|
720
747
|
active_machine = local? ? local_machine : machine
|
|
721
|
-
|
|
748
|
+
|
|
722
749
|
success = active_machine.upload(local_path, remote_path, config.export) do |name, sent, total|
|
|
723
|
-
info("#{name}: Sent #{sent} of #{total}", { :i18n => false })
|
|
724
|
-
yield(:progress, { :name => name, :sent => sent, :total => total })
|
|
750
|
+
info("#{name}: Sent #{sent} of #{total}", { :i18n => false }) unless quiet
|
|
751
|
+
yield(:progress, { :name => name, :sent => sent, :total => total })
|
|
725
752
|
end
|
|
726
|
-
|
|
753
|
+
|
|
727
754
|
if success && block_given?
|
|
728
|
-
info("Successfully finished upload of #{local_path} to #{remote_path}", { :i18n => false })
|
|
755
|
+
info("Successfully finished upload of #{local_path} to #{remote_path}", { :i18n => false }) unless quiet
|
|
729
756
|
process_success = yield(:process, hook_config)
|
|
730
|
-
success = process_success if process_success == false
|
|
757
|
+
success = process_success if process_success == false
|
|
731
758
|
end
|
|
732
|
-
|
|
759
|
+
|
|
733
760
|
if success
|
|
734
761
|
extension(:upload_success, hook_config)
|
|
735
762
|
end
|
|
@@ -739,30 +766,30 @@ class Node < Nucleon.plugin_class(:nucleon, :base)
|
|
|
739
766
|
end
|
|
740
767
|
success
|
|
741
768
|
end
|
|
742
|
-
|
|
769
|
+
|
|
743
770
|
#---
|
|
744
|
-
|
|
745
|
-
def send_files(local_path, remote_path, files = nil, permission = '0644', &code)
|
|
771
|
+
|
|
772
|
+
def send_files(local_path, remote_path, files = nil, permission = '0644', options = {}, &code)
|
|
746
773
|
local_path = File.expand_path(local_path)
|
|
747
774
|
return false unless File.directory?(local_path)
|
|
748
|
-
|
|
775
|
+
|
|
749
776
|
success = true
|
|
750
|
-
|
|
777
|
+
|
|
751
778
|
send_file = lambda do |local_file, remote_file|
|
|
752
|
-
send_success = upload(local_file, remote_file) do |op,
|
|
753
|
-
code.call(op,
|
|
779
|
+
send_success = upload(local_file, remote_file, options) do |op, upload_options|
|
|
780
|
+
code.call(op, upload_options) if code
|
|
754
781
|
end
|
|
755
782
|
send_success = cli_check(:chmod, permission, remote_file) if send_success
|
|
756
|
-
send_success
|
|
783
|
+
send_success
|
|
757
784
|
end
|
|
758
|
-
|
|
785
|
+
|
|
759
786
|
if files && files.is_a?(Array)
|
|
760
787
|
files.flatten.each do |rel_file_name|
|
|
761
788
|
local_file = "#{local_path}/#{rel_file_name}"
|
|
762
789
|
remote_file = "#{remote_path}/#{rel_file_name}"
|
|
763
|
-
|
|
790
|
+
|
|
764
791
|
if File.exists?(local_file)
|
|
765
|
-
send_success = send_file.call(local_file, remote_file)
|
|
792
|
+
send_success = send_file.call(local_file, remote_file)
|
|
766
793
|
success = false unless send_success
|
|
767
794
|
end
|
|
768
795
|
end
|
|
@@ -772,30 +799,30 @@ class Node < Nucleon.plugin_class(:nucleon, :base)
|
|
|
772
799
|
end
|
|
773
800
|
success
|
|
774
801
|
end
|
|
775
|
-
|
|
802
|
+
|
|
776
803
|
#---
|
|
777
|
-
|
|
804
|
+
|
|
778
805
|
def exec(options = {})
|
|
779
806
|
default_error = Util::Shell::Result.new(:error, 255)
|
|
780
807
|
results = [ default_error ]
|
|
781
|
-
|
|
808
|
+
|
|
782
809
|
if local? && local_machine || machine && machine.running?
|
|
783
810
|
config = Config.ensure(options)
|
|
784
|
-
|
|
811
|
+
|
|
785
812
|
if extension_check(:exec, { :config => config })
|
|
786
813
|
logger.info("Executing node: #{plugin_name}")
|
|
787
|
-
|
|
814
|
+
|
|
788
815
|
yield(:config, config) if block_given?
|
|
789
|
-
|
|
816
|
+
|
|
790
817
|
if local? && local_machine
|
|
791
818
|
active_machine = local_machine
|
|
792
819
|
else
|
|
793
820
|
active_machine = machine
|
|
794
821
|
end
|
|
795
|
-
|
|
822
|
+
|
|
796
823
|
if commands = config.get(:commands, nil)
|
|
797
824
|
quiet = config.get(:quiet, false)
|
|
798
|
-
|
|
825
|
+
|
|
799
826
|
begin
|
|
800
827
|
test = active_machine.exec(commands, config.export) do |type, command, data|
|
|
801
828
|
unless quiet
|
|
@@ -807,25 +834,25 @@ class Node < Nucleon.plugin_class(:nucleon, :base)
|
|
|
807
834
|
end
|
|
808
835
|
end
|
|
809
836
|
yield(:progress, { :type => type, :command => command, :data => data }) if block_given?
|
|
810
|
-
end
|
|
837
|
+
end
|
|
811
838
|
end
|
|
812
839
|
results = test if test
|
|
813
|
-
|
|
840
|
+
|
|
814
841
|
rescue => error
|
|
815
|
-
default_error.append_errors(error.message)
|
|
842
|
+
default_error.append_errors(error.message)
|
|
816
843
|
end
|
|
817
844
|
else
|
|
818
|
-
default_error.append_errors("No execution command")
|
|
845
|
+
default_error.append_errors("No execution command")
|
|
819
846
|
end
|
|
820
|
-
|
|
847
|
+
|
|
821
848
|
if results
|
|
822
849
|
success = true
|
|
823
850
|
results.each do |result|
|
|
824
|
-
success = false if result.status != code.success
|
|
851
|
+
success = false if result.status != code.success
|
|
825
852
|
end
|
|
826
853
|
if success
|
|
827
854
|
yield(:process, config) if block_given?
|
|
828
|
-
extension(:exec_success, { :config => config, :results => results })
|
|
855
|
+
extension(:exec_success, { :config => config, :results => results })
|
|
829
856
|
end
|
|
830
857
|
else
|
|
831
858
|
default_error.append_errors("No execution results")
|
|
@@ -835,107 +862,107 @@ class Node < Nucleon.plugin_class(:nucleon, :base)
|
|
|
835
862
|
end
|
|
836
863
|
else
|
|
837
864
|
default_error.append_errors("No attached machine")
|
|
838
|
-
|
|
865
|
+
|
|
839
866
|
logger.warn("Node #{plugin_name} does not have an attached machine or is not running so cannot execute commands")
|
|
840
867
|
end
|
|
841
|
-
results
|
|
868
|
+
results
|
|
842
869
|
end
|
|
843
|
-
|
|
870
|
+
|
|
844
871
|
#---
|
|
845
|
-
|
|
872
|
+
|
|
846
873
|
def cli
|
|
847
874
|
@cli_interface
|
|
848
875
|
end
|
|
849
|
-
|
|
876
|
+
|
|
850
877
|
#---
|
|
851
|
-
|
|
878
|
+
|
|
852
879
|
def command(command, options = {})
|
|
853
880
|
config = Config.ensure(options)
|
|
854
881
|
as_admin = config.delete(:as_admin, false)
|
|
855
882
|
remove_command = false
|
|
856
|
-
|
|
883
|
+
|
|
857
884
|
unless command.is_a?(CORL::Plugin::Command)
|
|
858
885
|
command = CORL.command(Config.new({ :command => command }).import(config), :bash)
|
|
859
886
|
remove_command = true
|
|
860
887
|
end
|
|
861
|
-
|
|
888
|
+
|
|
862
889
|
admin_command = ''
|
|
863
890
|
if as_admin
|
|
864
891
|
admin_command = 'sudo' if user.to_s != 'root'
|
|
865
892
|
admin_command = extension_set(:admin_command, admin_command, config)
|
|
866
893
|
end
|
|
867
|
-
|
|
894
|
+
|
|
868
895
|
config[:commands] = [ "#{admin_command} #{command.to_s}".strip ]
|
|
869
|
-
|
|
896
|
+
|
|
870
897
|
results = exec(config) do |op, data|
|
|
871
|
-
yield(op, data) if block_given?
|
|
898
|
+
yield(op, data) if block_given?
|
|
872
899
|
end
|
|
873
|
-
|
|
874
|
-
CORL.remove_plugin(command) if remove_command
|
|
875
|
-
results.first
|
|
900
|
+
|
|
901
|
+
CORL.remove_plugin(command) if remove_command
|
|
902
|
+
results.first
|
|
876
903
|
end
|
|
877
|
-
|
|
904
|
+
|
|
878
905
|
#---
|
|
879
|
-
|
|
906
|
+
|
|
880
907
|
def action(provider, options = {})
|
|
881
908
|
codes :network_load_error
|
|
882
|
-
|
|
909
|
+
|
|
883
910
|
config = Config.ensure(options).defaults({
|
|
884
911
|
:log_level => Nucleon.log_level,
|
|
885
|
-
:net_remote => :edit,
|
|
886
|
-
:net_provider => network.plugin_provider
|
|
912
|
+
:net_remote => :edit,
|
|
913
|
+
:net_provider => network.plugin_provider
|
|
887
914
|
})
|
|
888
|
-
|
|
915
|
+
|
|
889
916
|
logger.info("Executing remote action #{provider} with encoded arguments: #{config.export.inspect}")
|
|
890
|
-
|
|
917
|
+
|
|
891
918
|
encoded_config = Util::CLI.encode(Util::Data.clean(config.export))
|
|
892
919
|
action_config = extended_config(:action, {
|
|
893
|
-
:command => provider.to_s.gsub('_', ' '),
|
|
920
|
+
:command => provider.to_s.gsub('_', ' '),
|
|
894
921
|
:data => { :encoded => encoded_config }
|
|
895
922
|
})
|
|
896
|
-
|
|
897
|
-
quiet = config.get(:quiet, false)
|
|
923
|
+
|
|
924
|
+
quiet = config.get(:quiet, false)
|
|
898
925
|
result = command(:corl, { :subcommand => action_config, :as_admin => true, :quiet => quiet }) do |op, data|
|
|
899
|
-
yield(op, data) if block_given?
|
|
926
|
+
yield(op, data) if block_given?
|
|
900
927
|
end
|
|
901
|
-
|
|
928
|
+
|
|
902
929
|
# Update local network configuration so we capture any updates
|
|
903
930
|
if result.status == code.success && ! network.load({ :remote => config[:net_remote], :pull => true })
|
|
904
931
|
result.status = code.network_load_error
|
|
905
932
|
end
|
|
906
933
|
result
|
|
907
934
|
end
|
|
908
|
-
|
|
935
|
+
|
|
909
936
|
#---
|
|
910
|
-
|
|
937
|
+
|
|
911
938
|
def run
|
|
912
939
|
@action_interface
|
|
913
940
|
end
|
|
914
|
-
|
|
941
|
+
|
|
915
942
|
#---
|
|
916
|
-
|
|
943
|
+
|
|
917
944
|
def terminal(options = {})
|
|
918
945
|
myself.status = code.unknown_status
|
|
919
|
-
|
|
946
|
+
|
|
920
947
|
if machine && machine.running?
|
|
921
948
|
config = Config.ensure(options)
|
|
922
|
-
|
|
949
|
+
|
|
923
950
|
if extension_check(:terminal, { :config => config })
|
|
924
951
|
logger.info("Launching terminal for node: #{plugin_name}")
|
|
925
|
-
|
|
952
|
+
|
|
926
953
|
if local? && local_machine
|
|
927
954
|
active_machine = local_machine
|
|
928
955
|
else
|
|
929
956
|
active_machine = machine
|
|
930
957
|
end
|
|
931
|
-
|
|
958
|
+
|
|
932
959
|
config[:private_keys] = private_key
|
|
933
960
|
config[:port] = ssh_port
|
|
934
|
-
|
|
961
|
+
|
|
935
962
|
myself.status = active_machine.terminal(user, config.export)
|
|
936
|
-
|
|
963
|
+
|
|
937
964
|
if status == code.success
|
|
938
|
-
extension(:exec_success, { :config => config })
|
|
965
|
+
extension(:exec_success, { :config => config })
|
|
939
966
|
end
|
|
940
967
|
end
|
|
941
968
|
else
|
|
@@ -943,21 +970,25 @@ class Node < Nucleon.plugin_class(:nucleon, :base)
|
|
|
943
970
|
end
|
|
944
971
|
status == code.success
|
|
945
972
|
end
|
|
946
|
-
|
|
973
|
+
|
|
947
974
|
#---
|
|
948
|
-
|
|
975
|
+
|
|
949
976
|
def bootstrap(local_path, options = {})
|
|
950
977
|
config = Config.ensure(options)
|
|
951
978
|
myself.status = code.unknown_status
|
|
952
|
-
|
|
953
|
-
bootstrap_name
|
|
954
|
-
bootstrap_path
|
|
955
|
-
bootstrap_glob
|
|
956
|
-
bootstrap_init
|
|
957
|
-
|
|
979
|
+
|
|
980
|
+
bootstrap_name = 'bootstrap'
|
|
981
|
+
bootstrap_path = config.get(:bootstrap_path, File.join(CORL.lib_path, '..', bootstrap_name))
|
|
982
|
+
bootstrap_glob = config.get(:bootstrap_glob, '**/*.sh')
|
|
983
|
+
bootstrap_init = config.get(:bootstrap_init, 'bootstrap.sh')
|
|
984
|
+
bootstrap_scripts = config.get_array(:bootstrap_scripts)
|
|
985
|
+
|
|
958
986
|
user_home = config[:home]
|
|
959
987
|
auth_files = config.get_array(:auth_files)
|
|
960
|
-
|
|
988
|
+
|
|
989
|
+
reboot = config.get(:reboot, false)
|
|
990
|
+
dev_build = config.get(:dev_build, false)
|
|
991
|
+
|
|
961
992
|
codes :local_path_not_found,
|
|
962
993
|
:home_path_lookup_failure,
|
|
963
994
|
:auth_upload_failure,
|
|
@@ -965,61 +996,64 @@ class Node < Nucleon.plugin_class(:nucleon, :base)
|
|
|
965
996
|
:bootstrap_upload_failure,
|
|
966
997
|
:bootstrap_exec_failure,
|
|
967
998
|
:reload_failure
|
|
968
|
-
|
|
969
|
-
if File.directory?(local_path)
|
|
999
|
+
|
|
1000
|
+
if File.directory?(local_path)
|
|
970
1001
|
if user_home || user_home = home(config.get(:home_env_var, 'HOME'), config.get(:force, false))
|
|
971
1002
|
myself.status = code.success
|
|
972
|
-
|
|
1003
|
+
|
|
973
1004
|
# Transmit authorisation / credential files
|
|
974
1005
|
package_files = [ '.fog', '.netrc', '.google-privatekey.p12', '.vimrc' ]
|
|
975
1006
|
auth_files.each do |file|
|
|
976
1007
|
package_files << file.gsub(local_path + '/', '')
|
|
977
1008
|
end
|
|
978
|
-
send_success = send_files(local_path, user_home, package_files, '0600') do |op, data|
|
|
1009
|
+
send_success = send_files(local_path, user_home, package_files, '0600', { :quiet => true }) do |op, data|
|
|
979
1010
|
yield("send_#{op}".to_sym, data) if block_given?
|
|
980
1011
|
data
|
|
981
1012
|
end
|
|
982
1013
|
unless send_success
|
|
983
1014
|
myself.status = code.auth_upload_failure
|
|
984
1015
|
end
|
|
985
|
-
|
|
1016
|
+
|
|
986
1017
|
if user.to_sym != config.get(:root_user, :root).to_sym
|
|
987
1018
|
auth_files = package_files.collect { |path| "'#{path}'"}
|
|
988
1019
|
root_home_path = config.get(:root_home, '/root')
|
|
989
|
-
|
|
1020
|
+
|
|
990
1021
|
result = command("cp #{auth_files.join(' ')} #{root_home_path}", { :as_admin => true })
|
|
991
|
-
myself.status = code.root_auth_copy_failure unless result.status == code.success
|
|
1022
|
+
myself.status = code.root_auth_copy_failure unless result.status == code.success
|
|
992
1023
|
end
|
|
993
|
-
|
|
1024
|
+
|
|
994
1025
|
# Send bootstrap package
|
|
995
1026
|
if status == code.success
|
|
996
1027
|
remote_bootstrap_path = File.join(user_home, bootstrap_name)
|
|
997
|
-
|
|
1028
|
+
|
|
998
1029
|
cli.rm('-Rf', remote_bootstrap_path)
|
|
999
|
-
send_success = send_files(bootstrap_path, remote_bootstrap_path, nil, '0700') do |op, data|
|
|
1030
|
+
send_success = send_files(bootstrap_path, remote_bootstrap_path, nil, '0700', { :quiet => true }) do |op, data|
|
|
1000
1031
|
yield("send_#{op}".to_sym, data) if block_given?
|
|
1001
1032
|
data
|
|
1002
1033
|
end
|
|
1003
1034
|
unless send_success
|
|
1004
1035
|
myself.status = code.bootstrap_upload_failure
|
|
1005
1036
|
end
|
|
1006
|
-
|
|
1037
|
+
|
|
1007
1038
|
# Execute bootstrap process
|
|
1008
1039
|
if status == code.success
|
|
1009
1040
|
remote_script = File.join(remote_bootstrap_path, bootstrap_init)
|
|
1010
|
-
|
|
1041
|
+
environment = "HOSTNAME='#{hostname}' "
|
|
1042
|
+
environment << "DEVELOPMENT_BUILD=1 " if dev_build
|
|
1043
|
+
script_names = bootstrap_scripts.empty? ? '' : bootstrap_scripts.join(' ')
|
|
1044
|
+
|
|
1011
1045
|
myself.bootstrap_script = remote_script
|
|
1012
|
-
|
|
1013
|
-
result = command("
|
|
1046
|
+
|
|
1047
|
+
result = command("#{environment} #{remote_script} #{script_names}", { :as_admin => true }) do |op, data|
|
|
1014
1048
|
yield("exec_#{op}".to_sym, data) if block_given?
|
|
1015
1049
|
data
|
|
1016
1050
|
end
|
|
1017
|
-
|
|
1051
|
+
|
|
1018
1052
|
if result.status == code.success
|
|
1019
1053
|
# Reboot the machine
|
|
1020
|
-
|
|
1054
|
+
if reboot && ! reload
|
|
1021
1055
|
warn('corl.core.node.bootstrap.reload')
|
|
1022
|
-
myself.status = code.reload_failure
|
|
1056
|
+
myself.status = code.reload_failure
|
|
1023
1057
|
end
|
|
1024
1058
|
else
|
|
1025
1059
|
warn('corl.core.node.bootstrap.status', { :script => remote_script, :status => result.status })
|
|
@@ -1028,59 +1062,59 @@ class Node < Nucleon.plugin_class(:nucleon, :base)
|
|
|
1028
1062
|
end
|
|
1029
1063
|
end
|
|
1030
1064
|
else
|
|
1031
|
-
myself.status = code.home_path_lookup_failure
|
|
1065
|
+
myself.status = code.home_path_lookup_failure
|
|
1032
1066
|
end
|
|
1033
1067
|
else
|
|
1034
1068
|
myself.status = code.local_path_not_found
|
|
1035
1069
|
end
|
|
1036
1070
|
status == code.success
|
|
1037
1071
|
end
|
|
1038
|
-
|
|
1072
|
+
|
|
1039
1073
|
#---
|
|
1040
|
-
|
|
1074
|
+
|
|
1041
1075
|
def save(options = {})
|
|
1042
1076
|
config = Config.ensure(options)
|
|
1043
|
-
|
|
1077
|
+
|
|
1044
1078
|
# Record machine parameters
|
|
1045
1079
|
if block_given?
|
|
1046
1080
|
# Provider or external configuration preparation
|
|
1047
|
-
yield(config)
|
|
1081
|
+
yield(config)
|
|
1048
1082
|
else
|
|
1049
1083
|
# Default configuration preparation
|
|
1050
1084
|
id(true)
|
|
1051
1085
|
public_ip(true)
|
|
1052
1086
|
private_ip(true)
|
|
1053
1087
|
state(true)
|
|
1054
|
-
|
|
1088
|
+
|
|
1055
1089
|
machine_type(false)
|
|
1056
1090
|
image(false)
|
|
1057
1091
|
end
|
|
1058
|
-
|
|
1059
|
-
network.save(config.import({
|
|
1092
|
+
|
|
1093
|
+
network.save(config.import({
|
|
1060
1094
|
:commit => true,
|
|
1061
1095
|
:allow_empty => true,
|
|
1062
1096
|
:message => config.get(:message, "Saving #{plugin_provider} node #{plugin_name}"),
|
|
1063
1097
|
:remote => config.get(:remote, :edit)
|
|
1064
|
-
}))
|
|
1098
|
+
}))
|
|
1065
1099
|
end
|
|
1066
|
-
|
|
1100
|
+
|
|
1067
1101
|
#---
|
|
1068
|
-
|
|
1102
|
+
|
|
1069
1103
|
def start(options = {})
|
|
1070
1104
|
success = true
|
|
1071
|
-
|
|
1105
|
+
|
|
1072
1106
|
if machine
|
|
1073
1107
|
config = Config.ensure(options)
|
|
1074
|
-
|
|
1108
|
+
|
|
1075
1109
|
if extension_check(:start, { :config => config })
|
|
1076
1110
|
logger.info("Starting node: #{plugin_name}")
|
|
1077
|
-
|
|
1078
|
-
yield(:config, config) if block_given?
|
|
1111
|
+
|
|
1112
|
+
yield(:config, config) if block_given?
|
|
1079
1113
|
success = machine.start(config.export)
|
|
1080
1114
|
success = save(config) if success
|
|
1081
|
-
|
|
1115
|
+
|
|
1082
1116
|
if success
|
|
1083
|
-
if config.get(:bootstrap,
|
|
1117
|
+
if config.get(:bootstrap, false) && bootstrap_script
|
|
1084
1118
|
result = command("HOSTNAME='#{hostname}' #{bootstrap_script}", { :as_admin => true }) do |op, data|
|
|
1085
1119
|
yield("bootstrap_#{op}".to_sym, data) if block_given?
|
|
1086
1120
|
data
|
|
@@ -1088,12 +1122,12 @@ class Node < Nucleon.plugin_class(:nucleon, :base)
|
|
|
1088
1122
|
success = false unless result.status == code.success && reload
|
|
1089
1123
|
end
|
|
1090
1124
|
end
|
|
1091
|
-
|
|
1125
|
+
|
|
1092
1126
|
if success && block_given?
|
|
1093
1127
|
process_success = yield(:process, config)
|
|
1094
|
-
success = process_success if process_success == false
|
|
1128
|
+
success = process_success if process_success == false
|
|
1095
1129
|
end
|
|
1096
|
-
|
|
1130
|
+
|
|
1097
1131
|
if success
|
|
1098
1132
|
extension(:start_success, { :config => config })
|
|
1099
1133
|
end
|
|
@@ -1103,26 +1137,26 @@ class Node < Nucleon.plugin_class(:nucleon, :base)
|
|
|
1103
1137
|
end
|
|
1104
1138
|
success
|
|
1105
1139
|
end
|
|
1106
|
-
|
|
1140
|
+
|
|
1107
1141
|
#---
|
|
1108
|
-
|
|
1142
|
+
|
|
1109
1143
|
def reload(options = {})
|
|
1110
1144
|
success = true
|
|
1111
|
-
|
|
1145
|
+
|
|
1112
1146
|
if machine && machine.created?
|
|
1113
1147
|
config = Config.ensure(options)
|
|
1114
|
-
|
|
1148
|
+
|
|
1115
1149
|
if extension_check(:reload, { :config => config })
|
|
1116
1150
|
logger.info("Reloading node: #{plugin_name}")
|
|
1117
|
-
|
|
1118
|
-
yield(:config, config) if block_given?
|
|
1151
|
+
|
|
1152
|
+
yield(:config, config) if block_given?
|
|
1119
1153
|
success = machine.reload(config.export)
|
|
1120
|
-
|
|
1154
|
+
|
|
1121
1155
|
if success && block_given?
|
|
1122
1156
|
process_success = yield(:process, config)
|
|
1123
|
-
success = process_success if process_success == false
|
|
1157
|
+
success = process_success if process_success == false
|
|
1124
1158
|
end
|
|
1125
|
-
|
|
1159
|
+
|
|
1126
1160
|
if success
|
|
1127
1161
|
extension(:reload_success, { :config => config })
|
|
1128
1162
|
end
|
|
@@ -1132,27 +1166,27 @@ class Node < Nucleon.plugin_class(:nucleon, :base)
|
|
|
1132
1166
|
end
|
|
1133
1167
|
success
|
|
1134
1168
|
end
|
|
1135
|
-
|
|
1169
|
+
|
|
1136
1170
|
#---
|
|
1137
|
-
|
|
1171
|
+
|
|
1138
1172
|
def create_image(options = {})
|
|
1139
1173
|
success = true
|
|
1140
|
-
|
|
1174
|
+
|
|
1141
1175
|
if machine && machine.running?
|
|
1142
1176
|
config = Config.ensure(options)
|
|
1143
|
-
|
|
1177
|
+
|
|
1144
1178
|
if extension_check(:create_image, { :config => config })
|
|
1145
1179
|
logger.info("Executing node: #{plugin_name}")
|
|
1146
|
-
|
|
1147
|
-
yield(:config, config) if block_given?
|
|
1180
|
+
|
|
1181
|
+
yield(:config, config) if block_given?
|
|
1148
1182
|
success = machine.create_image(config.export)
|
|
1149
1183
|
success = save(config) if success
|
|
1150
|
-
|
|
1184
|
+
|
|
1151
1185
|
if success && block_given?
|
|
1152
1186
|
process_success = yield(:process, config)
|
|
1153
|
-
success = process_success if process_success == false
|
|
1187
|
+
success = process_success if process_success == false
|
|
1154
1188
|
end
|
|
1155
|
-
|
|
1189
|
+
|
|
1156
1190
|
if success
|
|
1157
1191
|
extension(:create_image_success, { :config => config })
|
|
1158
1192
|
end
|
|
@@ -1160,44 +1194,44 @@ class Node < Nucleon.plugin_class(:nucleon, :base)
|
|
|
1160
1194
|
else
|
|
1161
1195
|
logger.warn("Node #{plugin_name} does not have an attached machine or is not running so cannot create an image")
|
|
1162
1196
|
end
|
|
1163
|
-
success
|
|
1197
|
+
success
|
|
1164
1198
|
end
|
|
1165
|
-
|
|
1199
|
+
|
|
1166
1200
|
#---
|
|
1167
|
-
|
|
1201
|
+
|
|
1168
1202
|
def stop(options = {})
|
|
1169
1203
|
success = true
|
|
1170
|
-
|
|
1204
|
+
|
|
1171
1205
|
if machine && machine.running?
|
|
1172
1206
|
config = Config.ensure(options)
|
|
1173
|
-
|
|
1207
|
+
|
|
1174
1208
|
if extension_check(:stop, { :config => config })
|
|
1175
1209
|
logger.info("Stopping node: #{plugin_name}")
|
|
1176
|
-
|
|
1177
|
-
yield(:config, config) if block_given?
|
|
1210
|
+
|
|
1211
|
+
yield(:config, config) if block_given?
|
|
1178
1212
|
success = machine.stop(config.export)
|
|
1179
|
-
|
|
1213
|
+
|
|
1180
1214
|
myself.machine = nil
|
|
1181
|
-
|
|
1215
|
+
|
|
1182
1216
|
override_settings = false
|
|
1183
1217
|
override_settings = yield(:finalize, config) if success && block_given?
|
|
1184
|
-
|
|
1218
|
+
|
|
1185
1219
|
if success && ! override_settings
|
|
1186
1220
|
delete_setting(:id)
|
|
1187
1221
|
delete_setting(:public_ip)
|
|
1188
1222
|
delete_setting(:private_ip)
|
|
1189
1223
|
delete_setting(:ssh_port)
|
|
1190
1224
|
delete_setting(:build)
|
|
1191
|
-
|
|
1225
|
+
|
|
1192
1226
|
myself[:state] = :stopped
|
|
1193
1227
|
end
|
|
1194
1228
|
success = save(config)
|
|
1195
|
-
|
|
1229
|
+
|
|
1196
1230
|
if success && block_given?
|
|
1197
1231
|
process_success = yield(:process, config)
|
|
1198
|
-
success = process_success if process_success == false
|
|
1232
|
+
success = process_success if process_success == false
|
|
1199
1233
|
end
|
|
1200
|
-
|
|
1234
|
+
|
|
1201
1235
|
if success
|
|
1202
1236
|
extension(:stop_success, { :config => config })
|
|
1203
1237
|
end
|
|
@@ -1211,169 +1245,170 @@ class Node < Nucleon.plugin_class(:nucleon, :base)
|
|
|
1211
1245
|
#---
|
|
1212
1246
|
|
|
1213
1247
|
def destroy(options = {})
|
|
1214
|
-
config = Config.ensure(options)
|
|
1248
|
+
config = Config.ensure(options)
|
|
1215
1249
|
success = true
|
|
1216
|
-
|
|
1250
|
+
|
|
1217
1251
|
if extension_check(:destroy, { :config => config })
|
|
1218
1252
|
logger.info("Destroying node: #{plugin_name}")
|
|
1219
|
-
|
|
1253
|
+
|
|
1220
1254
|
yield(:config, config) if block_given?
|
|
1221
|
-
|
|
1255
|
+
|
|
1222
1256
|
if machine && machine.created?
|
|
1223
|
-
# Shut down machine
|
|
1257
|
+
# Shut down machine
|
|
1224
1258
|
success = machine.destroy(config.export)
|
|
1225
1259
|
myself.machine = nil
|
|
1226
1260
|
else
|
|
1227
1261
|
logger.warn("Node #{plugin_name} does not have an attached machine or is not created so cannot be destroyed")
|
|
1228
1262
|
end
|
|
1229
|
-
|
|
1263
|
+
|
|
1230
1264
|
# Remove SSH keys
|
|
1231
1265
|
if success && delete_keys
|
|
1232
1266
|
# Remove node information
|
|
1233
1267
|
network.delete_node(plugin_provider, plugin_name, false)
|
|
1234
|
-
|
|
1268
|
+
|
|
1235
1269
|
network.save({
|
|
1236
|
-
:commit => true,
|
|
1237
|
-
:remote => config.get(:remote, :edit),
|
|
1270
|
+
:commit => true,
|
|
1271
|
+
:remote => config.get(:remote, :edit),
|
|
1238
1272
|
:message => config.get(:message, "Destroying node #{plugin_name}"),
|
|
1239
|
-
:push => true
|
|
1273
|
+
:push => true
|
|
1240
1274
|
})
|
|
1241
|
-
end
|
|
1242
|
-
|
|
1275
|
+
end
|
|
1276
|
+
|
|
1243
1277
|
if success && block_given?
|
|
1244
1278
|
process_success = yield(:process, config)
|
|
1245
|
-
success = process_success if process_success == false
|
|
1279
|
+
success = process_success if process_success == false
|
|
1246
1280
|
end
|
|
1247
|
-
|
|
1281
|
+
|
|
1248
1282
|
if success
|
|
1249
1283
|
extension(:destroy_success, { :config => config })
|
|
1250
1284
|
clear_cache
|
|
1251
1285
|
end
|
|
1252
1286
|
end
|
|
1253
|
-
success
|
|
1287
|
+
success
|
|
1254
1288
|
end
|
|
1255
1289
|
|
|
1256
1290
|
#-----------------------------------------------------------------------------
|
|
1257
1291
|
# Utilities
|
|
1258
|
-
|
|
1259
|
-
def self.build_info(namespace, plugin_type, data)
|
|
1292
|
+
|
|
1293
|
+
def self.build_info(namespace, plugin_type, data)
|
|
1260
1294
|
data = data.split(/\s*,\s*/) if data.is_a?(String)
|
|
1261
1295
|
super(namespace, plugin_type, data)
|
|
1262
1296
|
end
|
|
1263
|
-
|
|
1297
|
+
|
|
1264
1298
|
#---
|
|
1265
|
-
|
|
1299
|
+
|
|
1266
1300
|
def self.translate(data)
|
|
1267
1301
|
options = super(data)
|
|
1268
|
-
|
|
1269
|
-
case data
|
|
1302
|
+
|
|
1303
|
+
case data
|
|
1270
1304
|
when String
|
|
1271
1305
|
options = { :name => data }
|
|
1272
1306
|
when Hash
|
|
1273
1307
|
options = data
|
|
1274
1308
|
end
|
|
1275
|
-
|
|
1309
|
+
|
|
1276
1310
|
if options.has_key?(:name)
|
|
1277
1311
|
if matches = translate_reference(options[:name])
|
|
1278
1312
|
options[:provider] = matches[:provider]
|
|
1279
1313
|
options[:name] = matches[:name]
|
|
1280
|
-
|
|
1281
|
-
logger.debug("Translating node options: #{options.inspect}")
|
|
1314
|
+
|
|
1315
|
+
logger.debug("Translating node options: #{options.inspect}")
|
|
1282
1316
|
end
|
|
1283
1317
|
end
|
|
1284
1318
|
options
|
|
1285
1319
|
end
|
|
1286
|
-
|
|
1320
|
+
|
|
1287
1321
|
#---
|
|
1288
|
-
|
|
1322
|
+
|
|
1289
1323
|
def self.translate_reference(reference)
|
|
1290
1324
|
# ex: rackspace:::web1.staging.example.com
|
|
1291
1325
|
if reference && reference.match(/^\s*([a-zA-Z0-9_-]+):::([^\s]+)\s*$/)
|
|
1292
1326
|
provider = $1
|
|
1293
1327
|
name = $2
|
|
1294
|
-
|
|
1328
|
+
|
|
1295
1329
|
logger.debug("Translating node reference: #{provider} #{name}")
|
|
1296
|
-
|
|
1330
|
+
|
|
1297
1331
|
info = {
|
|
1298
1332
|
:provider => provider,
|
|
1299
1333
|
:name => name
|
|
1300
1334
|
}
|
|
1301
|
-
|
|
1335
|
+
|
|
1302
1336
|
logger.debug("Project reference info: #{info.inspect}")
|
|
1303
1337
|
return info
|
|
1304
1338
|
end
|
|
1305
1339
|
nil
|
|
1306
1340
|
end
|
|
1307
|
-
|
|
1341
|
+
|
|
1308
1342
|
#---
|
|
1309
|
-
|
|
1343
|
+
|
|
1310
1344
|
def translate_reference(reference)
|
|
1311
1345
|
myself.class.translate_reference(reference)
|
|
1312
1346
|
end
|
|
1313
|
-
|
|
1347
|
+
|
|
1314
1348
|
#-----------------------------------------------------------------------------
|
|
1315
1349
|
# CLI utilities
|
|
1316
|
-
|
|
1350
|
+
|
|
1317
1351
|
def cli_capture(cli_command, *args)
|
|
1318
|
-
result =
|
|
1319
|
-
|
|
1320
|
-
|
|
1352
|
+
result = exec({ :commands => [ [ cli_command, args ].flatten.join(' ') ], :quiet => true })
|
|
1353
|
+
result = result.first
|
|
1354
|
+
|
|
1355
|
+
if result.status == code.success && ! result.output.empty?
|
|
1321
1356
|
result.output
|
|
1322
1357
|
else
|
|
1323
1358
|
nil
|
|
1324
|
-
end
|
|
1359
|
+
end
|
|
1325
1360
|
end
|
|
1326
|
-
|
|
1361
|
+
|
|
1327
1362
|
#---
|
|
1328
|
-
|
|
1363
|
+
|
|
1329
1364
|
def cli_check(cli_command, *args)
|
|
1330
1365
|
result = cli.send(cli_command, args)
|
|
1331
|
-
result.status == code.success ? true : false
|
|
1366
|
+
result.status == code.success ? true : false
|
|
1332
1367
|
end
|
|
1333
|
-
|
|
1368
|
+
|
|
1334
1369
|
#---
|
|
1335
|
-
|
|
1370
|
+
|
|
1336
1371
|
def filter_output(type, data)
|
|
1337
1372
|
if type == :output
|
|
1338
1373
|
# Hide redundant Facter output
|
|
1339
1374
|
if data =~ /^Already evaluated [a-z]+ at [^,]+, reevaluating anyways$/
|
|
1340
1375
|
data = ''
|
|
1341
|
-
end
|
|
1376
|
+
end
|
|
1342
1377
|
end
|
|
1343
|
-
data
|
|
1378
|
+
data
|
|
1344
1379
|
end
|
|
1345
|
-
|
|
1380
|
+
|
|
1346
1381
|
#-----------------------------------------------------------------------------
|
|
1347
1382
|
# Machine type utilities
|
|
1348
|
-
|
|
1383
|
+
|
|
1349
1384
|
def machine_type_id(machine_type)
|
|
1350
1385
|
machine_type.id
|
|
1351
1386
|
end
|
|
1352
|
-
|
|
1387
|
+
|
|
1353
1388
|
#---
|
|
1354
|
-
|
|
1389
|
+
|
|
1355
1390
|
def render_machine_type(machine_type)
|
|
1356
|
-
''
|
|
1391
|
+
''
|
|
1357
1392
|
end
|
|
1358
|
-
|
|
1393
|
+
|
|
1359
1394
|
#-----------------------------------------------------------------------------
|
|
1360
1395
|
# Image utilities
|
|
1361
|
-
|
|
1396
|
+
|
|
1362
1397
|
def image_id(image)
|
|
1363
1398
|
image.id
|
|
1364
1399
|
end
|
|
1365
|
-
|
|
1400
|
+
|
|
1366
1401
|
#---
|
|
1367
|
-
|
|
1402
|
+
|
|
1368
1403
|
def render_image(image)
|
|
1369
|
-
''
|
|
1404
|
+
''
|
|
1370
1405
|
end
|
|
1371
|
-
|
|
1406
|
+
|
|
1372
1407
|
#---
|
|
1373
|
-
|
|
1408
|
+
|
|
1374
1409
|
def image_search_text(image)
|
|
1375
1410
|
image.to_s
|
|
1376
|
-
end
|
|
1411
|
+
end
|
|
1377
1412
|
end
|
|
1378
1413
|
end
|
|
1379
1414
|
end
|