Class: Puppet::ModuleTool::Applications::Installer
- Inherits:
-
Application
- Object
- Application
- Puppet::ModuleTool::Applications::Installer
- Includes:
- Forge::Errors, Errors, Shared
- Defined in:
- lib/puppet/module_tool/applications/installer.rb
Constant Summary
Constants inherited from Application
Application::DOCPATTERN, Application::SHOULD_PARSE_CONFIG_DEPRECATION_MSG
Constants included from Util
Util::AbsolutePathPosix, Util::AbsolutePathWindows, Util::DEFAULT_POSIX_MODE, Util::DEFAULT_WINDOWS_MODE
Constants included from Util::POSIX
Util::POSIX::LOCALE_ENV_VARS, Util::POSIX::USER_ENV_VARS
Constants included from Util::SymbolicFileMode
Util::SymbolicFileMode::SetGIDBit, Util::SymbolicFileMode::SetUIDBit, Util::SymbolicFileMode::StickyBit, Util::SymbolicFileMode::SymbolicMode, Util::SymbolicFileMode::SymbolicSpecialToBit
Instance Attribute Summary
Attributes inherited from Application
Instance Method Summary collapse
-
#initialize(name, forge, install_dir, 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
[], #app_defaults, available_application_names, banner, clear!, clear?, clear_everything_for_tests, #configure_indirector_routes, controlled_run, exit, find, #handle_logdest_arg, #handlearg, #help, #initialize_app_defaults, interrupted?, #main, #name, option, option_parser_commands, #parse_options, #preinit, restart!, restart_requested?, #run_command, run_mode, #set_log_level, #setup, #setup_logs, should_not_parse_config, should_parse_config, should_parse_config?, stop!, stop_requested?, try_load_class
Methods included from Util
absolute_path?, activerecord_version, benchmark, binread, chuser, classproxy, deterministic_rand, execfail, execpipe, execute, exit_on_fail, logmethods, memory, path_to_uri, pretty_backtrace, proxy, replace_file, safe_posix_fork, symbolizehash, thinmark, uri_to_path, which, withenv, withumask
Methods included from Util::POSIX
#get_posix_field, #gid, #idfield, #methodbyid, #methodbyname, #search_posix_field, #uid
Methods included from Util::SymbolicFileMode
#normalize_symbolic_mode, #symbolic_mode_to_int, #valid_symbolic_mode?
Constructor Details
#initialize(name, forge, install_dir, options = {}) ⇒ Installer
Returns a new instance of Installer.
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/puppet/module_tool/applications/installer.rb', line 18 def initialize(name, forge, install_dir, = {}) super() @action = :install @environment = Puppet::Node::Environment.new(Puppet.settings[:environment]) @force = [:force] @ignore_dependencies = [:force] || [:ignore_dependencies] @name = name @forge = forge @install_dir = install_dir end |
Instance Method Details
#run ⇒ Object
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 77 |
# File 'lib/puppet/module_tool/applications/installer.rb', line 29 def run results = {} begin if is_module_package?(@name) @source = :filesystem @filename = File.(@name) raise MissingPackageError, :requested_package => @filename unless Puppet::FileSystem::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], } @install_dir.prepare(@module_name, @version || 'latest') 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, .merge(:target_dir => dir)).run end end end rescue ModuleToolError, ForgeError => err results[:error] = { :oneline => err., :multiline => err.multiline, } else results[:result] = :success results[:installed_modules] = @graph ensure results[:result] ||= :failure end results end |