Module: PoolParty
- Includes:
- FileWriter
- Defined in:
- lib/poolparty.rb,
lib/poolparty.rb,
lib/poolparty.rb,
lib/poolparty/lite.rb,
lib/poolparty/schema.rb,
lib/poolparty/resources.rb,
lib/poolparty/plugins/git.rb,
lib/poolparty/plugins/svn.rb,
lib/poolparty/dependencies.rb,
lib/poolparty/plugins/bind.rb,
lib/poolparty/plugins/host.rb,
lib/poolparty/plugins/ruby.rb,
lib/poolparty/plugins/runit.rb,
lib/poolparty/poolparty/key.rb,
lib/poolparty/extra/duration.rb,
lib/poolparty/helpers/binary.rb,
lib/poolparty/helpers/ruberl.rb,
lib/poolparty/installers/ec2.rb,
lib/poolparty/modules/output.rb,
lib/poolparty/modules/pinger.rb,
lib/poolparty/plugins/sshkey.rb,
lib/poolparty/poolparty/pool.rb,
lib/poolparty/resources/cron.rb,
lib/poolparty/resources/exec.rb,
lib/poolparty/resources/file.rb,
lib/poolparty/resources/user.rb,
lib/poolparty/helpers/console.rb,
lib/poolparty/helpers/loading.rb,
lib/poolparty/plugins/haproxy.rb,
lib/poolparty/poolparty/cloud.rb,
lib/poolparty/resources/group.rb,
lib/poolparty/resources/mount.rb,
lib/poolparty/helpers/optioner.rb,
lib/poolparty/installers/vmrun.rb,
lib/poolparty/net/remoter_base.rb,
lib/poolparty/poolparty/plugin.rb,
lib/poolparty/poolparty/script.rb,
lib/poolparty/modules/callbacks.rb,
lib/poolparty/modules/cloud_dsl.rb,
lib/poolparty/plugins/chef/chef.rb,
lib/poolparty/plugins/heartbeat.rb,
lib/poolparty/poolparty/default.rb,
lib/poolparty/poolparty/service.rb,
lib/poolparty/resources/package.rb,
lib/poolparty/resources/service.rb,
lib/poolparty/resources/symlink.rb,
lib/poolparty/poolparty/resource.rb,
lib/poolparty/poolparty/template.rb,
lib/poolparty/resources/variable.rb,
lib/poolparty/modules/file_writer.rb,
lib/poolparty/net/remote_instance.rb,
lib/poolparty/plugins/gem_package.rb,
lib/poolparty/resources/directory.rb,
lib/poolparty/verification/verify.rb,
lib/poolparty/helpers/hash_printer.rb,
lib/poolparty/modules/user_helpers.rb,
lib/poolparty/plugins/apache2/php5.rb,
lib/poolparty/plugins/line_in_file.rb,
lib/poolparty/plugins/rails_deploy.rb,
lib/poolparty/modules/safe_instance.rb,
lib/poolparty/resources/remote_file.rb,
lib/poolparty/modules/pretty_printer.rb,
lib/poolparty/modules/resourcing_dsl.rb,
lib/poolparty/plugins/apache2/apache.rb,
lib/poolparty/plugins/authorized_key.rb,
lib/poolparty/provision/dr_configure.rb,
lib/poolparty/modules/cloud_resourcer.rb,
lib/poolparty/monitors/monitor_daemon.rb,
lib/poolparty/net/remoter/connections.rb,
lib/poolparty/net/remoter/interactive.rb,
lib/poolparty/plugins/plugin_template.rb,
lib/poolparty/poolparty/neighborhoods.rb,
lib/poolparty/provision/boot_strapper.rb,
lib/poolparty/modules/searchable_paths.rb,
lib/poolparty/plugins/chef/chef_deploy.rb,
lib/poolparty/plugins/chef/chef_recipe.rb,
lib/poolparty/plugins/deploy_directory.rb,
lib/poolparty/installers/base_installer.rb,
lib/poolparty/net/remoter/cloud_control.rb,
lib/poolparty/net/remoter_bases/ec2/ec2.rb,
lib/poolparty/plugins/chef/chef_library.rb,
lib/poolparty/dependency_resolver/puppet.rb,
lib/poolparty/modules/definable_resource.rb,
lib/poolparty/verification/verifier_base.rb,
lib/poolparty/verification/verifiers/ping.rb,
lib/poolparty/plugins/apache2/virtual_host.rb,
lib/poolparty/net/remoter_bases/vmrun/vmrun.rb,
lib/poolparty/provision/configurations/chef.rb,
lib/poolparty/plugins/apache2/passenger_site.rb,
lib/poolparty/poolparty/poolparty_base_class.rb,
lib/poolparty/plugins/poolparty_base_packages.rb,
lib/poolparty/provision/configurations/puppet.rb,
lib/poolparty/plugins/chef/include_chef_recipe.rb,
lib/poolparty/dependency_resolver/chef_resolver.rb,
lib/poolparty/net/remoter_bases/libvirt/libvirt.rb,
lib/poolparty/verification/verifiers/http_match.rb,
lib/poolparty/verification/verifiers/http_status.rb,
lib/poolparty/dependency_resolver/puppet_resolver.rb,
lib/poolparty/net/remoter_bases/metavirt/metavirt.rb,
lib/poolparty/plugins/chef/chef_deploy_definition.rb,
lib/poolparty/net/remoter_bases/vmrun/vmrun_instance.rb,
lib/poolparty/dependency_resolver/dependency_resolver.rb,
lib/poolparty/net/remoter_bases/ec2/ec2_remote_instance.rb,
lib/poolparty/net/remoter_bases/libvirt/libvirt_instance.rb,
lib/poolparty/net/remoter_bases/metavirt/metavirt_instance.rb,
lib/poolparty/dependency_resolver/dependency_resolver_cloud_extensions.rb
Overview
Cloud extensions for the DependencyResolver
Defined Under Namespace
Modules: Binary, Callbacks, Cloud, CloudDsl, CloudResourcer, Console, DefinableResource, DependencyResolutions, DependencyResolverCloudExtensions, DependencyResolverResourceExtensions, FileWriter, Installers, Loading, Output, Pinger, Plugin, Pool, PrettyPrinter, Provision, Remote, Resources, ResourcingDsl, Ruberl, SearchablePaths, ThreadSafeInstance, Verification, Verifiers Classes: ChefResolver, Default, Dependencies, DependencyResolver, DirectoryMissingError, Duration, HashPrinter, Key, MonitorDaemon, Neighborhoods, Optioner, PoolParty, PoolPartyBaseClass, PuppetResolver, RecipeNotFoundError, ReposMissingError, Schema, Script, Service, Template, Verify
Class Method Summary collapse
Instance Method Summary collapse
- #context_stack ⇒ Object
- #extract_cloud_from_options(o) ⇒ Object
- #extract_pool_from_options(o) ⇒ Object
-
#load_pool(filename = nil) ⇒ Object
Load a file that contains a pool into memory.
- #log ⇒ Object
-
#pack_user_directory(dirname) ⇒ Object
Add to the suitcase files below the clouds.rb base directory.
-
#pool_specfile ⇒ Object
Keep the pool_specfile.
-
#print_with_nice_printer(header = nil, strs = []) {|printer| ... } ⇒ Object
Helper to print with the nice printer.
-
#require_user_directory(dirname) ⇒ Object
Require all the files in a directory below the base.
- #reset! ⇒ Object
Methods included from Remote
are_any_nodes_exceeding_minimum_runtime?, are_too_few_instances_running?, are_too_many_instances_running?, available, commands, execute!, list_of_instances, list_of_nodes_exceeding_minimum_runtime, netssh, nodes, remote_rsync_command, remote_ssh_array, remote_ssh_string, rsync, rsync_command, rsync_storage_files_to, rsync_storage_files_to_command, rsync_to, rsync_to_command, run_command_on, run_command_on_command, run_command_on_instance_number, run_local, run_remote, scp_array, scp_to_command, simplest_run_remote, ssh_array, ssh_command, ssh_into, ssh_into_instance_number, ssh_options, ssh_string, target_host
Methods included from Pinger
Methods included from FileWriter
#cleanup_storage_directory, #clear_base_directory, #copy_directory_into_storage_directory, #copy_directory_into_template_storage_directory, #copy_file_to_storage_directory, #copy_template_to_storage_directory, #make_base_directory, #make_base_path, #make_directory_in_storage_directory, #make_template_directory, #write_to_file, #write_to_file_in_storage_directory, #write_to_temp_file
Class Method Details
.load_cloud_from_json(json_file_path = nil) ⇒ Object
23 24 25 26 |
# File 'lib/poolparty/lite.rb', line 23 def self.load_cloud_from_json(json_file_path=nil) json_file = json_file_path || PoolParty::Default.properties_hash_file PoolParty::Schema.new( ::File.read(json_file) ) rescue exit 1 end |
.require_directory(dir) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/poolparty.rb', line 48 def PoolParty.require_directory(dir) if ::File.file?(dir) require dir else Dir["#{dir}/*.rb"].sort.each do |file| require "#{file}" if ::File.file?(file) end Dir["#{dir}/*"].sort.each do |dir| require_directory(dir) if ::File.directory?(dir) end end end |
Instance Method Details
#context_stack ⇒ Object
12 13 14 |
# File 'lib/poolparty/poolparty/poolparty_base_class.rb', line 12 def context_stack $context_stack ||= [] end |
#extract_cloud_from_options(o) ⇒ Object
154 155 156 |
# File 'lib/poolparty/helpers/optioner.rb', line 154 def (o) o.cloudname ? [cloud(o.cloudname.downcase.to_sym)] : clouds.collect {|n,cl| cl} end |
#extract_pool_from_options(o) ⇒ Object
158 159 160 |
# File 'lib/poolparty/helpers/optioner.rb', line 158 def (o) o.poolname ? [pool(o.poolname.downcase.to_sym)] : pools.collect {|n,pl| pl} end |
#load_pool(filename = nil) ⇒ Object
Load a file that contains a pool into memory
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/poolparty/helpers/binary.rb', line 5 def load_pool(filename=nil) filename = filename || Binary.get_existing_spec_location dputs "Using spec at #{filename}" unless filename && ::File.readable?(filename) puts "Please specify your cloud with -s, move it to ./clouds.rb or in your POOL_SPEC environment variable" exit(1) else $pool_specfile = filename PoolParty::Pool::Pool.load_from_file filename end end |
#log ⇒ Object
113 114 115 |
# File 'lib/poolparty.rb', line 113 def log @logger ||= make_new_logger rescue STDOUT end |
#pack_user_directory(dirname) ⇒ Object
Add to the suitcase files below the clouds.rb base directory
13 14 15 16 17 18 19 |
# File 'lib/poolparty/modules/user_helpers.rb', line 13 def pack_user_directory(dirname) begin ::Suitcase::Zipper.add("#{::File.dirname($pool_specfile)}/#{dirname}", "/etc/poolparty") rescue Exception => e vputs "Error packing user directory #{dirname}: #{e}" end end |
#pool_specfile ⇒ Object
Keep the pool_specfile
30 31 32 |
# File 'lib/poolparty/helpers/binary.rb', line 30 def pool_specfile $pool_specfile end |
#print_with_nice_printer(header = nil, strs = []) {|printer| ... } ⇒ Object
Helper to print with the nice printer
19 20 21 22 23 24 25 26 27 |
# File 'lib/poolparty/helpers/binary.rb', line 19 def print_with_nice_printer(header=nil, strs=[], &block) printer = NicePrinter.new printer.header printer.center(header) if header yield(printer) strs.each {|st| printer << st if st} printer. printer.print end |
#require_user_directory(dirname) ⇒ Object
Require all the files in a directory below the base
3 4 5 6 7 8 9 10 |
# File 'lib/poolparty/modules/user_helpers.rb', line 3 def require_user_directory(dirname) begin cloud_dir = ::File.dirname($pool_specfile) Dir["#{cloud_dir}/#{dirname}/**"].each {|a| require a } rescue Exception => e vputs "Error requiring user directory #{dirname}: #{e}" end end |
#reset! ⇒ Object
116 117 118 |
# File 'lib/poolparty.rb', line 116 def reset! $pools = $clouds = $plugins = @describe_instances = nil end |