btw, the repo is here :
http://github.com/phantez/puppet/tree/tickets/master/2250
--
Stéphan Gorget
On Thu, May 14, 2009 at 12:15 AM, Stéphan Gorget <pha...@gmail.com> wrote:
> From: Stéphan Gorget <pha...@gmail.com>
>
> Signed-off-by: Stéphan Gorget <pha...@gmail.com>
> Signed-off-by: Stéphan Gorget <pha...@gmail.com>
> ---
> lib/puppet/module.rb | 5 ++++-
> spec/unit/module.rb | 6 +++---
> 2 files changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/lib/puppet/module.rb b/lib/puppet/module.rb
> index 45b4069..284aa37 100644
> --- a/lib/puppet/module.rb
> +++ b/lib/puppet/module.rb
> @@ -78,7 +78,10 @@ class Puppet::Module
> # check in the default template dir, if there is one
> unless td_file = find_template_for_module(template, environment)
> raise Puppet::Error, "No valid template directory found, please check templatedir settings" if template_paths.nil?
> - td_file = File::join(template_paths.first, template)
> + unless templ = template_paths.first
> + templ = ""
> + end
> + td_file = File::join(templ, template)
> end
> td_file
> end
> diff --git a/spec/unit/module.rb b/spec/unit/module.rb
> index 313de67..323defa 100755
> --- a/spec/unit/module.rb
> +++ b/spec/unit/module.rb
> @@ -172,7 +172,7 @@ describe Puppet::Module, " when searching for templates" do
>
> it "should return the template from the first found module" do
> mod = mock 'module'
> - Puppet::Node::Environment.new.expects(:module).with("mymod").returns mod
> + Puppet::Node::Environment.new("myenv").expects(:module).with("mymod").returns mod
>
> mod.expects(:template).returns("/one/mymod/templates/mytemplate")
> Puppet::Module.find_template("mymod/mytemplate").should == "/one/mymod/templates/mytemplate"
> @@ -193,7 +193,7 @@ describe Puppet::Module, " when searching for templates" do
>
> it "should not raise an error if no valid templatedir exists and the template exists in a module" do
> mod = mock 'module'
> - Puppet::Node::Environment.new.expects(:module).with("mymod").returns mod
> + Puppet::Node::Environment.new("myenv").expects(:module).with("mymod").returns mod
>
> mod.expects(:template).returns("/one/mymod/templates/mytemplate")
> Puppet::Module.stubs(:templatepath).with(nil).returns(nil)
> @@ -306,7 +306,7 @@ describe Puppet::Module, " when searching for manifests in a found module" do
>
> it "should return the manifests from the first found module" do
> mod = mock 'module'
> - Puppet::Node::Environment.new.expects(:module).with("mymod").returns mod
> + Puppet::Node::Environment.new("myenv").expects(:module).with("mymod").returns mod
> mod.expects(:match_manifests).with("init.pp").returns(%w{/one/mymod/manifests/init.pp})
> Puppet::Module.find_manifests("mymod/init.pp").should == ["/one/mymod/manifests/init.pp"]
> end
> --
> 1.6.2.4
>
>
Stéphan Gorget wrote:
> Signed-off-by: Stéphan Gorget <pha...@gmail.com>
> ---
> lib/puppet/module.rb | 5 ++++-
> spec/unit/module.rb | 6 +++---
> 2 files changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/lib/puppet/module.rb b/lib/puppet/module.rb
> index 45b4069..284aa37 100644
> --- a/lib/puppet/module.rb
> +++ b/lib/puppet/module.rb
> @@ -78,7 +78,10 @@ class Puppet::Module
> # check in the default template dir, if there is one
> unless td_file = find_template_for_module(template, environment)
> raise Puppet::Error, "No valid template directory found, please check templatedir settings" if template_paths.nil?
> - td_file = File::join(template_paths.first, template)
> + unless templ = template_paths.first
> + templ = ""
> + end
> + td_file = File::join(templ, template)
> end
Whilst kudos for fixing the bug as such shouldn't we also add something
in the way of an error message?
Or maybe I am missing something.
James
- --
Author of:
* Pro Linux Systems Administration
(http://www.amazon.com/gp/product/1430219122/)
* Pulling Strings with Puppet
(http://www.amazon.com/gp/product/1590599780/)
* Pro Nagios 2.0
(http://www.amazon.com/gp/product/1590596099/)
* Hardening Linux
(http://www.amazon.com/gp/product/1590594444/)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkoMzhQACgkQ9hTGvAxC30DpsgCgs2jm+BwcqEYmaIw8nVjyBsbI
0ogAoNLbVnRwqRue8OP7TB6zbNOetf30
=ihB+
-----END PGP SIGNATURE-----
This is why I added the new ticket for the module API - we should fix
this issue, but we should fix it using this new API. And it should be
straightforward to do so.
--
I'm worried about Bart. Today, he's sucking people's blood,
tommorrow he might be smoking. -Marge Simpson