[DRE-commits] [librarian-puppet] 41/153: Issue #243 Warn if Modulefile doesn't contain a version

Stig Sandbeck Mathisen ssm at debian.org
Wed Jun 1 20:30:38 UTC 2016


This is an automated email from the git hooks/post-receive script.

ssm pushed a commit to branch master
in repository librarian-puppet.

commit ec117b0c3cdff28ac9048c85431c00e1ba88d101
Author: Carlos Sanchez <csanchez at maestrodev.com>
Date:   Sat Aug 2 17:14:49 2014 +0200

    Issue #243 Warn if Modulefile doesn't contain a version
---
 Changelog.md                         |  2 ++
 features/install.feature             | 19 +++++++++++++++++++
 lib/librarian/puppet/source/local.rb |  1 +
 3 files changed, 22 insertions(+)

diff --git a/Changelog.md b/Changelog.md
index 1cb7ccc..1852786 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -6,6 +6,7 @@
 
  * If no Puppetfile is present default to use the `metadata.json` or `Modulefile`
  * [Issue #235](https://github.com/rodjek/librarian-puppet/issues/235) Error when forge is not defined in `Puppetfile`
+ * [Issue #243](https://github.com/rodjek/librarian-puppet/issues/243) Warn if `Modulefile` doesn't contain a version
 
 ### 1.2.0
 
@@ -41,6 +42,7 @@
 
  * If no Puppetfile is present default to use the `metadata.json` or `Modulefile`
  * [Issue #235](https://github.com/rodjek/librarian-puppet/issues/235) Error when forge is not defined in `Puppetfile`
+ * [Issue #243](https://github.com/rodjek/librarian-puppet/issues/243) Warn if `Modulefile` doesn't contain a version
 
 
 ### 1.0.6
diff --git a/features/install.feature b/features/install.feature
index 21997ea..77fe34d 100644
--- a/features/install.feature
+++ b/features/install.feature
@@ -21,3 +21,22 @@ Feature: cli/install
     And the file "modules/stdlib/Modulefile" should match /version *'3\.0\.0'/
     And the output should not contain "Executing puppet module install for puppetlabs/stdlib"
     And the output should not contain "Executing puppet module install for puppetlabs-stdlib"
+
+  Scenario: Install a module with Modulefile without version
+    Given a file named "Puppetfile" with:
+    """
+    forge "http://forge.puppetlabs.com"
+
+    mod 'librarian-bad_modulefile', :path => 'bad_modulefile'
+    """
+    And a directory named "bad_modulefile/manifests"
+    And a file named "bad_modulefile/Modulefile" with:
+    """
+    # bad Modulefile
+    """
+    When I run `librarian-puppet install`
+    Then the exit status should be 0
+    And the output should match:
+    """
+    Unable to parse .*/bad_modulefile/Modulefile, ignoring: Missing version
+    """
diff --git a/lib/librarian/puppet/source/local.rb b/lib/librarian/puppet/source/local.rb
index a295492..9d3bbce 100644
--- a/lib/librarian/puppet/source/local.rb
+++ b/lib/librarian/puppet/source/local.rb
@@ -94,6 +94,7 @@ module Librarian
           metadata = ::Puppet::ModuleTool::Metadata.new
           begin
             ::Puppet::ModuleTool::ModulefileReader.evaluate(metadata, modulefile)
+            raise SyntaxError, "Missing version" unless metadata.version
           rescue ArgumentError, SyntaxError => error
             warn { "Unable to parse #{modulefile}, ignoring: #{error}" }
             if metadata.respond_to? :version=

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/librarian-puppet.git



More information about the Pkg-ruby-extras-commits mailing list