lib/librarian/puppet/source/forge.rb in librarian-puppet-0.9.6 vs lib/librarian/puppet/source/forge.rb in librarian-puppet-0.9.7
- old
+ new
@@ -84,12 +84,11 @@
# The puppet module command is only available from puppet versions >= 2.7.13
#
# Specifying the version in the gemspec would force people to upgrade puppet while it's still usable for git
# So we do some more clever checking
#
- # Executing older versions or via puppet-module tool gives an exit status = 0 .
- # Therefore we check the available options via the help page
+ # Executing older versions or via puppet-module tool gives an exit status = 0 .
#
check_puppet_module_options
path.mkpath
@@ -107,24 +106,16 @@
end
end
def check_puppet_module_options
- command = "puppet help module install"
- options = [ '--target-dir', '--modulepath','--ignore-dependencies' ]
- output = `#{command}`
+ min_version = Gem::Version.create('2.7.13')
+ puppet_version = Gem::Version.create(`puppet --version`.strip)
- # Check puppet module for used options
- has_options = true
- options.each do |option|
- unless output.include?(option)
- has_options = false
- end
+ if puppet_version < min_version
+ raise Error, "To get modules from the forge, we use the puppet faces module command. Your current version does not support the options #{options.join(',')} . For this you need at least puppet version 2.7.13 and you have #{puppet_version}"
end
- unless has_options
- raise Error, "To get modules from the forge, we use the puppet faces module command. Your current version does not support the options #{options.join(',')} . For this you need at least puppet version 2.7.13"
- end
end
def vendored?(name, version)
vendored_path(name, version).exist?
end
@@ -269,10 +260,10 @@
def fetch_dependencies(name, version, version_uri)
repo(name).dependencies(version).map do |k, v|
Dependency.new(k, v, nil)
end
end
-
+
def manifests(name)
repo(name).manifests
end
private