lib/bolt/pal.rb
# Return information about a module.
#
# @param name [String] The name of the module.
# @return [Hash]
#
Return information about a module.
Return information about a module .
def show_module(name)
      name = name.tr('-', '/')
      data = in_bolt_compiler do |_compiler|
        mod = Puppet.lookup(:current_environment).module(name.split(%r{[/-]}, 2).last)
        unless mod && (mod.forge_name == name || mod.name == name)
          raise Bolt::Error.new("Could not find module '#{name}' on the modulepath.", 'bolt/unknown-module')
        end
        {
          name:     mod.forge_name || mod.name,
          metadata: mod.metadata,
          path:     mod.path,
          plans:    mod.plans.map(&:name).sort,
          tasks:    mod.tasks.map(&:name).sort
        }
      end
      data[:plans] = list_plans_with_cache.to_h.slice(*data[:plans]).to_a
      data[:tasks] = list_tasks_with_cache.to_h.slice(*data[:tasks]).to_a
      data
    end
def show_module ( name ) name = name . tr ( '-' , '/' ) data = in_bolt_compiler do | _compiler | mod = Puppet . lookup ( :current_environment ) . module ( name . split ( %r{ [/-] } , 2 ) . last ) unless mod && ( mod . forge_name == name || mod . name == name ) raise Bolt :: Error . new ( "Could not find module '#{name}' on the modulepath." , 'bolt/unknown-module' ) end { name : mod . forge_name || mod . name , metadata : mod . metadata , path : mod . path , plans : mod . plans . map ( & :name ) . sort , tasks : mod . tasks . map ( & :name ) . sort } end data [ :plans ] = list_plans_with_cache . to_h . slice ( * data [ :plans ] ) . to_a data [ :tasks ] = list_tasks_with_cache . to_h . slice ( * data [ :tasks ] ) . to_a data end
Return information about a module.
Return information about a module .
None
Hash
name
The name of the module.
The name of the module .