Module: Librarian::Puppet

Extended by:
Librarian, Puppet
Included in:
Puppet
Defined in:
lib/librarian/puppet.rb,
lib/librarian/puppet/cli.rb,
lib/librarian/puppet/dsl.rb,
lib/librarian/puppet/util.rb,
lib/librarian/puppet/version.rb,
lib/librarian/puppet/lockfile.rb,
lib/librarian/puppet/extension.rb,
lib/librarian/puppet/dependency.rb,
lib/librarian/puppet/source/git.rb,
lib/librarian/puppet/environment.rb,
lib/librarian/puppet/source/path.rb,
lib/librarian/puppet/source/repo.rb,
lib/librarian/puppet/source/forge.rb,
lib/librarian/puppet/source/local.rb,
lib/librarian/puppet/action/install.rb,
lib/librarian/puppet/action/resolve.rb,
lib/librarian/puppet/source/forge/repo.rb,
lib/librarian/puppet/source/forge/repo_v1.rb,
lib/librarian/puppet/source/forge/repo_v3.rb,
lib/librarian/puppet/source/githubtarball.rb,
lib/librarian/puppet/source/githubtarball/repo.rb

Defined Under Namespace

Modules: Action, Source, Util Classes: Cli, Dependency, Dsl, Environment, Lockfile

Constant Summary collapse

VERSION =
"2.2.4"
@@puppet_version =
nil

Instance Method Summary collapse

Instance Method Details

#puppet_gem_versionObject

Puppet version x.y.z translated as a Gem version



31
32
33
# File 'lib/librarian/puppet.rb', line 31

def puppet_gem_version
  Gem::Version.create(puppet_version.split(' ').first.strip.gsub('-', '.'))
end

#puppet_versionObject

Output of puppet –version, typically x.y.z For Puppet Enterprise it contains the PE version too, ie. 3.4.3 (Puppet Enterprise 3.2.1)



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/librarian/puppet.rb', line 15

def puppet_version
  return @@puppet_version unless @@puppet_version.nil?

  begin
    @@puppet_version = Librarian::Posix.run!(%W{puppet --version}).strip
  rescue Errno::ENOENT, Librarian::Posix::CommandFailure => error
    msg = "Unable to load puppet. Please install it using native packages for your platform (eg .deb, .rpm, .dmg, etc)."
    msg += "\npuppet --version returned #{error.status}" if error.respond_to? :status
    msg += "\n#{error.message}" unless error.message.nil?
    $stderr.puts msg
    exit 1
  end
  return @@puppet_version
end