diff --git a/lib/puppet/face/module/install.rb b/lib/puppet/face/module/install.rb index 929ff9db8..0644d0518 100644 --- a/lib/puppet/face/module/install.rb +++ b/lib/puppet/face/module/install.rb @@ -1,144 +1,145 @@ # encoding: UTF-8 require 'puppet/forge' require 'puppet/module_tool/install_directory' require 'pathname' Puppet::Face.define(:module, '1.0.0') do action(:install) do summary "Install a module from the Puppet Forge or a release archive." description <<-EOT Installs a module from the Puppet Forge or from a release archive file. The specified module will be installed into the directory specified with the `--target-dir` option, which defaults to the first directory in the modulepath. EOT returns "Pathname object representing the path to the installed module." examples <<-'EOT' Install a module: $ puppet module install puppetlabs-vcsrepo Preparing to install into /etc/puppet/modules ... Downloading from http://forgeapi.puppetlabs.com ... Installing -- do not interrupt ... /etc/puppet/modules └── puppetlabs-vcsrepo (v0.0.4) Install a module to a specific environment: $ puppet module install puppetlabs-vcsrepo --environment development Preparing to install into /etc/puppet/environments/development/modules ... Downloading from http://forgeapi.puppetlabs.com ... Installing -- do not interrupt ... /etc/puppet/environments/development/modules └── puppetlabs-vcsrepo (v0.0.4) Install a specific module version: $ puppet module install puppetlabs-vcsrepo -v 0.0.4 Preparing to install into /etc/puppet/modules ... Downloading from http://forgeapi.puppetlabs.com ... Installing -- do not interrupt ... /etc/puppet/modules └── puppetlabs-vcsrepo (v0.0.4) Install a module into a specific directory: $ puppet module install puppetlabs-vcsrepo --target-dir=/usr/share/puppet/modules Preparing to install into /usr/share/puppet/modules ... Downloading from http://forgeapi.puppetlabs.com ... Installing -- do not interrupt ... /usr/share/puppet/modules └── puppetlabs-vcsrepo (v0.0.4) Install a module into a specific directory and check for dependencies in other directories: $ puppet module install puppetlabs-vcsrepo --target-dir=/usr/share/puppet/modules --modulepath /etc/puppet/modules Preparing to install into /usr/share/puppet/modules ... Downloading from http://forgeapi.puppetlabs.com ... Installing -- do not interrupt ... /usr/share/puppet/modules └── puppetlabs-vcsrepo (v0.0.4) Install a module from a release archive: $ puppet module install puppetlabs-vcsrepo-0.0.4.tar.gz Preparing to install into /etc/puppet/modules ... Downloading from http://forgeapi.puppetlabs.com ... Installing -- do not interrupt ... /etc/puppet/modules └── puppetlabs-vcsrepo (v0.0.4) Install a module from a release archive and ignore dependencies: $ puppet module install puppetlabs-vcsrepo-0.0.4.tar.gz --ignore-dependencies Preparing to install into /etc/puppet/modules ... Installing -- do not interrupt ... /etc/puppet/modules └── puppetlabs-vcsrepo (v0.0.4) EOT arguments "" option "--force", "-f" do - summary "Force overwrite of existing module, if any." + summary "Force overwrite of existing module, if any. (Implies --ignore-dependencies.)" description <<-EOT Force overwrite of existing module, if any. + Implies --ignore-dependencies. EOT end option "--target-dir DIR", "-i DIR" do summary "The directory into which modules are installed." description <<-EOT The directory into which modules are installed; defaults to the first directory in the modulepath. Specifying this option will change the installation directory, and will use the existing modulepath when checking for dependencies. If you wish to check a different set of directories for dependencies, you must also use the `--environment` or `--modulepath` options. EOT end option "--ignore-dependencies" do - summary "Do not attempt to install dependencies" + summary "Do not attempt to install dependencies. (Implied by --force.)" description <<-EOT - Do not attempt to install dependencies. (Implied by --force.) + Do not attempt to install dependencies. Implied by --force. EOT end option "--version VER", "-v VER" do summary "Module version to install." description <<-EOT Module version to install; can be an exact version or a requirement string, eg '>= 1.0.3'. Defaults to latest version. EOT end when_invoked do |name, options| Puppet::ModuleTool.set_option_defaults options Puppet.notice "Preparing to install into #{options[:target_dir]} ..." install_dir = Puppet::ModuleTool::InstallDirectory.new(Pathname.new(options[:target_dir])) Puppet::ModuleTool::Applications::Installer.run(name, install_dir, options) end when_rendering :console do |return_value, name, options| if return_value[:result] == :noop Puppet.notice "Module #{name} #{return_value[:version]} is already installed." exit 0 elsif return_value[:result] == :failure Puppet.err(return_value[:error][:multiline]) exit 1 else tree = Puppet::ModuleTool.build_tree(return_value[:graph], return_value[:install_dir]) "#{return_value[:install_dir]}\n" + Puppet::ModuleTool.format_tree(tree) end end end end diff --git a/lib/puppet/face/module/upgrade.rb b/lib/puppet/face/module/upgrade.rb index fe9dde644..2cb197702 100644 --- a/lib/puppet/face/module/upgrade.rb +++ b/lib/puppet/face/module/upgrade.rb @@ -1,78 +1,79 @@ # encoding: UTF-8 Puppet::Face.define(:module, '1.0.0') do action(:upgrade) do summary "Upgrade a puppet module." description <<-EOT Upgrades a puppet module. EOT returns "Hash" examples <<-EOT upgrade an installed module to the latest version $ puppet module upgrade puppetlabs-apache /etc/puppet/modules └── puppetlabs-apache (v1.0.0 -> v2.4.0) upgrade an installed module to a specific version $ puppet module upgrade puppetlabs-apache --version 2.1.0 /etc/puppet/modules └── puppetlabs-apache (v1.0.0 -> v2.1.0) upgrade an installed module for a specific environment $ puppet module upgrade puppetlabs-apache --environment test /usr/share/puppet/environments/test/modules └── puppetlabs-apache (v1.0.0 -> v2.4.0) EOT arguments "" option "--force", "-f" do - summary "Force upgrade of an installed module." + summary "Force upgrade of an installed module. (Implies --ignore-dependencies.)" description <<-EOT Force the upgrade of an installed module even if there are local changes or the possibility of causing broken dependencies. + Implies --ignore-dependencies. EOT end option "--ignore-dependencies" do - summary "Do not attempt to install dependencies" + summary "Do not attempt to install dependencies. (Implied by --force.)" description <<-EOT - Do not attempt to install dependencies. (Implied by --force.) + Do not attempt to install dependencies. Implied by --force. EOT end option "--version=" do summary "The version of the module to upgrade to." description <<-EOT The version of the module to upgrade to. EOT end when_invoked do |name, options| name = name.gsub('/', '-') Puppet.notice "Preparing to upgrade '#{name}' ..." Puppet::ModuleTool.set_option_defaults options Puppet::ModuleTool::Applications::Upgrader.new(name, options).run end when_rendering :console do |return_value| if return_value[:result] == :noop Puppet.notice return_value[:error][:multiline] exit 0 elsif return_value[:result] == :failure Puppet.err(return_value[:error][:multiline]) exit 1 else tree = Puppet::ModuleTool.build_tree(return_value[:graph], return_value[:base_dir]) "#{return_value[:base_dir]}\n" + Puppet::ModuleTool.format_tree(tree) end end end end