Class: Puppet::ModuleTool::Applications::Installer
- Inherits:
-
Application
- Object
- Application
- Puppet::ModuleTool::Applications::Installer
- Defined in:
- lib/vendor/puppet/module_tool/applications/installer.rb
Constant Summary
Constants inherited from Application
Constants included from Util
Util::AbsolutePathPosix, Util::AbsolutePathWindows
Instance Attribute Summary
Attributes inherited from Application
Instance Method Summary collapse
-
#initialize(name, options = {}) ⇒ Installer
constructor
A new instance of Installer.
- #run ⇒ Object
Methods included from Shared
#annotated_version, #download_tarballs, #get_local_constraints, #get_remote_constraints, #implicit_version, #resolve_constraints
Methods inherited from Application
[], banner, clear!, clear?, #configure_indirector_routes, controlled_run, exit, find, #handlearg, #help, interrupted?, #main, #name, option, option_parser_commands, #parse_options, #preinit, restart!, restart_requested?, #run_command, run_mode, #set_run_mode, #setup, #setup_logs, should_not_parse_config, should_parse_config, #should_parse_config?, should_parse_config?, stop!, stop_requested?
Methods included from Util
absolute_path?, activerecord_version, benchmark, binread, chuser, classproxy, #execfail, #execpipe, execute, execute_posix, execute_windows, logmethods, memory, path_to_uri, proxy, replace_file, safe_posix_fork, symbolize, symbolizehash, symbolizehash!, synchronize_on, thinmark, #threadlock, uri_to_path, wait_for_output, which, withumask
Methods included from Util::POSIX
#get_posix_field, #gid, #idfield, #methodbyid, #methodbyname, #search_posix_field, #uid
Constructor Details
#initialize(name, options = {}) ⇒ Installer
Returns a new instance of Installer.
15 16 17 18 19 20 21 22 |
# File 'lib/vendor/puppet/module_tool/applications/installer.rb', line 15 def initialize(name, = {}) @action = :install @environment = Puppet::Node::Environment.new(Puppet.settings[:environment]) @force = [:force] @ignore_dependencies = [:force] || [:ignore_dependencies] @name = name super() end |
Instance Method Details
#run ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/vendor/puppet/module_tool/applications/installer.rb', line 24 def run begin if is_module_package?(@name) @source = :filesystem @filename = File.(@name) raise MissingPackageError, :requested_package => @filename unless File.exist?(@filename) parsed = parse_filename(@filename) @module_name = parsed[:module_name] @version = parsed[:version] else @source = :repository @module_name = @name.gsub('/', '-') @version = [:version] end results = { :module_name => @module_name, :module_version => @version, :install_dir => [:target_dir], } unless File.directory? [:target_dir] raise MissingInstallDirectoryError, :requested_module => @module_name, :requested_version => @version || 'latest', :directory => [:target_dir] end cached_paths = get_release_packages unless @graph.empty? Puppet.notice 'Installing -- do not interrupt ...' cached_paths.each do |hash| hash.each do |dir, path| Unpacker.new(path, @options.merge(:target_dir => dir)).run end end end rescue ModuleToolError => err results[:error] = { :oneline => err., :multiline => err.multiline, } else results[:result] = :success results[:installed_modules] = @graph ensure results[:result] ||= :failure end results end |