Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
(#6513) Adjust P::U::Settings test name to reflect what it tests
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  9 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Jacob Helwig  
View profile  
 More options Mar 5 2011, 1:48 pm
From: Jacob Helwig <ja...@puppetlabs.com>
Date: Sat, 5 Mar 2011 12:48:04 -0600
Local: Sat, Mar 5 2011 1:48 pm
Subject: [PATCH/puppet 1/2] (#6513) Adjust P::U::Settings test name to reflect what it tests
The 'should interpolate found values using the current environment' wasn't
actually testing what it was describing, since the environment variable is
special cased.

Signed-off-by: Jacob Helwig <ja...@puppetlabs.com>
---

Local branch: ticket/2.6.x/6513-propigate-environment-in-settings-values

 spec/unit/util/settings_spec.rb |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/spec/unit/util/settings_spec.rb b/spec/unit/util/settings_spec.rb
index 7bca44b..3ed843b 100755
--- a/spec/unit/util/settings_spec.rb
+++ b/spec/unit/util/settings_spec.rb
@@ -331,7 +331,7 @@ describe Puppet::Util::Settings do
       @settings.value(:one, "env").should == "envval"
     end

-    it "should interpolate found values using the current environment" do
+    it 'should use the current environment for $environment' do
       @settings.setdefaults :main, :myval => ["$environment/foo", "mydocs"]

       @settings.value(:myval, "myenv").should == "myenv/foo"
--
1.7.4.1


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "(#6513) Propagate the environment when doing variable lookup in settings" by Jacob Helwig
Jacob Helwig  
View profile  
 More options Mar 5 2011, 1:48 pm
From: Jacob Helwig <ja...@puppetlabs.com>
Date: Sat, 5 Mar 2011 12:48:05 -0600
Local: Sat, Mar 5 2011 1:48 pm
Subject: [PATCH/puppet 2/2] (#6513) Propagate the environment when doing variable lookup in settings
For example with the following:

test.conf:
  [master]
      rrddir = /var/lib/puppet/rrd
      templatedir = /var/lib/puppet/templates
  [env_a]
      templatedir = $rrddir/templates
      rrddir = /tmp/env_a/

The command:
  RUBYLIB=lib bin/puppet master --config ./test.conf --environment env_a --configprint templatedir

originally produced '/var/lib/puppet/rrd/templates' instead of the
expected '/tmp/env_a/templates'

Signed-off-by: Jacob Helwig <ja...@puppetlabs.com>
---

Local branch: ticket/2.6.x/6513-propigate-environment-in-settings-values

 lib/puppet/util/settings.rb     |    2 +-
 spec/unit/util/settings_spec.rb |   11 ++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/lib/puppet/util/settings.rb b/lib/puppet/util/settings.rb
index 626ed20..f243b86 100644
--- a/lib/puppet/util/settings.rb
+++ b/lib/puppet/util/settings.rb
@@ -91,7 +91,7 @@ class Puppet::Util::Settings
       varname = $2 || $1
       if varname == "environment" and environment
         environment
-      elsif pval = self.value(varname)
+      elsif pval = self.value(varname, environment)
         pval
       else
         raise Puppet::DevError, "Could not find value for #{value}"
diff --git a/spec/unit/util/settings_spec.rb b/spec/unit/util/settings_spec.rb
index 3ed843b..07b712c 100755
--- a/spec/unit/util/settings_spec.rb
+++ b/spec/unit/util/settings_spec.rb
@@ -284,7 +284,8 @@ describe Puppet::Util::Settings do
       @settings = Puppet::Util::Settings.new
       @settings.setdefaults :section,
         :config => ["/my/file", "a"],
-        :one => ["ONE", "a"]
+        :one => ["ONE", "a"],
+        :two => ["TWO", "b"]
       FileTest.stubs(:exist?).returns true
       Puppet.stubs(:run_mode).returns stub('run_mode', :name => :mymode)
     end
@@ -337,6 +338,14 @@ describe Puppet::Util::Settings do
       @settings.value(:myval, "myenv").should == "myenv/foo"
     end

+    it "should interpolate found values using the current environment" do
+      text = "[main]\none = mainval\n[myname]\none = nameval\ntwo = $one/two\n"
+      @settings.stubs(:read_file).returns(text)
+      @settings.parse
+
+      @settings.value(:two, "myname").should == "nameval/two"
+    end
+
     it "should return values in a specified environment before values in the main or name sections" do
       text = "[env]\none = envval\n[main]\none = mainval\n[myname]\none = nameval\n"
       @settings.stubs(:read_file).returns(text)
--
1.7.4.1


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "[PATCH/puppet 2/2] (#6513) Propagate the environment when doing variable lookup in settings" by Nigel Kersten
Nigel Kersten  
View profile  
 More options Mar 6 2011, 3:44 pm
From: Nigel Kersten <ni...@puppetlabs.com>
Date: Sun, 6 Mar 2011 12:44:36 -0800
Local: Sun, Mar 6 2011 3:44 pm
Subject: Re: [Puppet-dev] [PATCH/puppet 2/2] (#6513) Propagate the environment when doing variable lookup in settings

Jacob, is this actually expanding the list of supported settings in
environments?

As I understand it, the only settings that work on a per-environment basis
currently are modulepath and manifestdir, and I thought this was a
deliberate design decision to push people towards using modules, rather than
explicitly having a templatedir, libdir, etc per environment.

I'm not at all convinced yet that every setting available in [master] should
be able to be set per [environment].


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nigel Kersten  
View profile  
 More options Mar 6 2011, 3:45 pm
From: Nigel Kersten <ni...@puppetlabs.com>
Date: Sun, 6 Mar 2011 12:45:11 -0800
Local: Sun, Mar 6 2011 3:45 pm
Subject: Re: [Puppet-dev] [PATCH/puppet 2/2] (#6513) Propagate the environment when doing variable lookup in settings

On Sun, Mar 6, 2011 at 12:44 PM, Nigel Kersten <ni...@puppetlabs.com> wrote:

> As I understand it, the only settings that work on a per-environment basis
> currently are modulepath and manifestdir, and I

Correction: modulepath and manifest, not manifestdir.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jacob Helwig  
View profile  
 More options Mar 6 2011, 4:15 pm
From: Jacob Helwig <ja...@puppetlabs.com>
Date: Sun, 06 Mar 2011 15:15:28 -0600
Local: Sun, Mar 6 2011 4:15 pm
Subject: Re: [Puppet-dev] [PATCH/puppet 2/2] (#6513) Propagate the environment when doing variable lookup in settings

Nigel Kersten <ni...@puppetlabs.com> wrote:
On Sun, Mar 6, 2011 at 12:44 PM, Nigel Kersten <ni...@puppetlabs.com> wrote:

As I understand it, the only settings that work on a per-environment basis currently are modulepath and manifestdir, and I

Correction: modulepath and manifest, not manifestdir.

It's not expanding the list of things that can be set per environment (which currently aren't limited to that list, anyway). It is letting you set your environment modulepath relative to that environment's manifestdir, if you were setting both in the environment. Currently this would not actually Do The Right Thing.
--
Sent from my phone. Please excuse my brevity.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Luke Kanies  
View profile  
 More options Mar 6 2011, 5:19 pm
From: Luke Kanies <l...@puppetlabs.com>
Date: Sun, 6 Mar 2011 14:19:11 -0800
Local: Sun, Mar 6 2011 5:19 pm
Subject: Re: [Puppet-dev] [PATCH/puppet 2/2] (#6513) Propagate the environment when doing variable lookup in settings

On Mar 6, 2011, at 1:15 PM, Jacob Helwig wrote:

> Nigel Kersten <ni...@puppetlabs.com> wrote:
> On Sun, Mar 6, 2011 at 12:44 PM, Nigel Kersten <ni...@puppetlabs.com> wrote:

> As I understand it, the only settings that work on a per-environment basis currently are modulepath and manifestdir, and I

> Correction: modulepath and manifest, not manifestdir.

> It's not expanding the list of things that can be set per environment (which currently aren't limited to that list, anyway). It is letting you set your environment modulepath relative to that environment's manifestdir, if you were setting both in the environment. Currently this would not actually Do The Right Thing.

As Jacob said, per-environment settings aren't limited at all any more, and I don't think they have been for the whole 2.6 release series.

--
Always behave like a duck - keep calm and unruffled on the surface but
paddle like the devil underneath.   -- Jacob Braude
---------------------------------------------------------------------
Luke Kanies  -|-   http://puppetlabs.com   -|-   +1(615)594-8199


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nigel Kersten  
View profile  
 More options Mar 6 2011, 6:45 pm
From: Nigel Kersten <ni...@puppetlabs.com>
Date: Sun, 6 Mar 2011 15:45:28 -0800
Local: Sun, Mar 6 2011 6:45 pm
Subject: Re: [Puppet-dev] [PATCH/puppet 2/2] (#6513) Propagate the environment when doing variable lookup in settings

On Sun, Mar 6, 2011 at 2:19 PM, Luke Kanies <l...@puppetlabs.com> wrote:

> As Jacob said, per-environment settings aren't limited at all any more, and
> I don't think they have been for the whole 2.6 release series.

Not every setting available in [master] works on a per-environment basis.
exec_terminus etc come to mind. Did we document what changed in 2.6.x in
this regard?

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jacob Helwig  
View profile  
 More options Mar 6 2011, 8:02 pm
From: Jacob Helwig <ja...@puppetlabs.com>
Date: Sun, 06 Mar 2011 19:02:08 -0600
Local: Sun, Mar 6 2011 8:02 pm
Subject: Re: [Puppet-dev] [PATCH/puppet 2/2] (#6513) Propagate the environment when doing variable lookup in settings

Nigel Kersten <ni...@puppetlabs.com> wrote:
On Sun, Mar 6, 2011 at 2:19 PM, Luke Kanies <l...@puppetlabs.com> wrote:

As Jacob said, per-environment settings aren't limited at all any more, and I don't think they have been for the whole 2.6 release series.

Not every setting available in [master] works on a per-environment basis. exec_terminus etc come to mind. Did we document what changed in 2.6.x in this regard?

--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to puppet-dev@googlegroups.com.
To unsubscribe from this group, send email to puppet-dev+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.

We should probably break this into a separate thread, since this is starting to sound like we've moved on to discussing a separate bug or documentation issue.
--
Sent from my phone. Please excuse my brevity.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Luke Kanies  
View profile  
 More options Mar 6 2011, 8:19 pm
From: Luke Kanies <l...@puppetlabs.com>
Date: Sun, 6 Mar 2011 17:19:12 -0800
Local: Sun, Mar 6 2011 8:19 pm
Subject: Re: [Puppet-dev] [PATCH/puppet 2/2] (#6513) Propagate the environment when doing variable lookup in settings

On Mar 6, 2011, at 3:45 PM, Nigel Kersten <ni...@puppetlabs.com> wrote:

On Sun, Mar 6, 2011 at 2:19 PM, Luke Kanies <l...@puppetlabs.com> wrote:

> As Jacob said, per-environment settings aren't limited at all any more, and
> I don't think they have been for the whole 2.6 release series.

Not every setting available in [master] works on a per-environment basis.
exec_terminus etc come to mind. Did we document what changed in 2.6.x in
this regard?

I agree with Jacob that this is a separate thread, but the short rule is:

All settings support environments, but not all of the code that uses
settings does.  E.g., anything global like the terminus settings is still,
um, global.

It's nearly impossible to document all of these, unfortunately, but we
should clearly do a better job.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »