puppet 3.0.0.rc4 → 3.0.0.rc5

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of puppet might be problematic. Click here for more details.

data/CHANGELOG CHANGED
@@ -1,3 +1,15 @@
1
+ 3.0.0rc5
2
+ ===
3
+ 88171aa Maint: Use pending block
4
+ 33bf085 Maint: Make paths absolute on Windows
5
+ 54acfba (#16137) Delay evaluation of config and var directories
6
+ b53e600 (#16137) Tilde expansion should only occur for normal users
7
+ 43590bd (Maint) Remove trailing whitespace
8
+ c0ff98d (#16137) Ensure HOME is set before attempting ~ expansion
9
+ 224d380 Move singleton require to puppet/util/storage.rb
10
+ 605e34d (#15739) Bump report_version since #10064 change its format
11
+ d834e76 (#6143) ensure that destroy works for zpools
12
+
1
13
  3.0.0rc4
2
14
  ===
3
15
  adcab02 (#15966) Update gem.rake task for correct facter version dependency
@@ -13,16 +13,16 @@
13
13
 
14
14
  Name: puppet
15
15
  Version: 3.0.0
16
- Release: 0.1rc4%{?dist}
16
+ Release: 0.1rc5%{?dist}
17
17
  #Release: 1%{?dist}
18
18
  Vendor: %{?_host_vendor}
19
19
  Summary: A network tool for managing many disparate systems
20
20
  License: ASL 2.0
21
21
  URL: http://puppetlabs.com
22
- Source0: http://puppetlabs.com/downloads/%{name}/%{name}-%{version}.tar.gz
23
- #Source0: http://puppetlabs.com/downloads/%{name}/%{name}-%{version}rc3.tar.gz
24
- Source1: http://puppetlabs.com/downloads/%{name}/%{name}-%{version}.tar.gz.asc
25
- #Source1: http://puppetlabs.com/downloads/%{name}/%{name}-%{version}rc3.tar.gz.asc
22
+ #Source0: http://puppetlabs.com/downloads/%{name}/%{name}-%{version}.tar.gz
23
+ Source0: http://puppetlabs.com/downloads/%{name}/%{name}-%{version}rc5.tar.gz
24
+ #Source1: http://puppetlabs.com/downloads/%{name}/%{name}-%{version}.tar.gz.asc
25
+ Source1: http://puppetlabs.com/downloads/%{name}/%{name}-%{version}rc5.tar.gz.asc
26
26
 
27
27
  Group: System Environment/Base
28
28
 
@@ -76,8 +76,8 @@ Provides the central puppet server daemon which provides manifests to clients.
76
76
  The server can also function as a certificate authority and file server.
77
77
 
78
78
  %prep
79
- %setup -q -n %{name}-%{version}
80
- #%setup -q -n %{name}-%{version}rc3
79
+ #%setup -q -n %{name}-%{version}
80
+ %setup -q -n %{name}-%{version}rc5
81
81
  patch -s -p1 < conf/redhat/rundir-perms.patch
82
82
 
83
83
 
@@ -279,6 +279,9 @@ fi
279
279
  rm -rf %{buildroot}
280
280
 
281
281
  %changelog
282
+ * Wed Aug 29 2012 Moses Mendoza <moses@puppetlabs.com> - 3.0.0-0.1rc5
283
+ - Update for 3.0.0 rc5
284
+
282
285
  * Fri Aug 24 2012 Eric Sorenson <eric0@puppetlabs.com> - 3.0.0-0.1rc4
283
286
  - Facter requirement is 1.6.11, not 2.0
284
287
  - Update for 3.0.0 rc4
data/lib/puppet.rb CHANGED
@@ -7,7 +7,6 @@ rescue LoadError
7
7
  end
8
8
 
9
9
  # see the bottom of the file for further inclusions
10
- require 'singleton'
11
10
  require 'facter'
12
11
  require 'puppet/error'
13
12
  require 'puppet/util'
@@ -97,7 +97,7 @@ Puppet::Type.type(:zpool).provide(:zpool) do
97
97
  zpool(*([:create, @resource[:pool]] + build_vdevs + build_named("spare") + build_named("log")))
98
98
  end
99
99
 
100
- def delete
100
+ def destroy
101
101
  zpool :destroy, @resource[:pool]
102
102
  end
103
103
 
@@ -37,8 +37,8 @@ class Puppet::Settings
37
37
  :logdir => run_mode.log_dir,
38
38
  }
39
39
  end
40
-
41
- def self.default_certname()
40
+
41
+ def self.default_certname()
42
42
  hostname = hostname_fact
43
43
  domain = domain_fact
44
44
  if domain and domain != ""
@@ -47,31 +47,14 @@ class Puppet::Settings
47
47
  fqdn = hostname
48
48
  end
49
49
  fqdn.gsub(/\.$/, '')
50
- end
50
+ end
51
51
 
52
52
  def self.hostname_fact()
53
- Facter["hostname"].value
54
- end
53
+ Facter["hostname"].value
54
+ end
55
55
 
56
56
  def self.domain_fact()
57
57
  Facter["domain"].value
58
- end
59
-
60
-
61
- def self.default_global_config_dir
62
- Puppet.features.microsoft_windows? ? File.join(Dir::COMMON_APPDATA, "PuppetLabs", "puppet", "etc") : "/etc/puppet"
63
- end
64
-
65
- def self.default_user_config_dir
66
- File.expand_path("~/.puppet")
67
- end
68
-
69
- def self.default_global_var_dir
70
- Puppet.features.microsoft_windows? ? File.join(Dir::COMMON_APPDATA, "PuppetLabs", "puppet", "var") : "/var/lib/puppet"
71
- end
72
-
73
- def self.default_user_var_dir
74
- File.expand_path("~/.puppet/var")
75
58
  end
76
59
 
77
60
  def self.default_config_file_name
@@ -519,13 +502,13 @@ class Puppet::Settings
519
502
  if explicit_config_file?
520
503
  return self[:config]
521
504
  else
522
- return File.join(self.class.default_global_config_dir, config_file_name)
505
+ return File.join(Puppet::Util::RunMode[:master].conf_dir, config_file_name)
523
506
  end
524
507
  end
525
508
  private :main_config_file
526
509
 
527
510
  def user_config_file
528
- return File.join(self.class.default_user_config_dir, config_file_name)
511
+ return File.join(Puppet::Util::RunMode[:user].conf_dir, config_file_name)
529
512
  end
530
513
  private :user_config_file
531
514
 
@@ -76,7 +76,7 @@ class Puppet::Transaction::Report
76
76
  @host = Puppet[:node_name_value]
77
77
  @time = Time.now
78
78
  @kind = kind
79
- @report_format = 2
79
+ @report_format = 3
80
80
  @puppet_version = Puppet.version
81
81
  @configuration_version = configuration_version
82
82
  @environment = environment
@@ -7,12 +7,15 @@ module Puppet
7
7
  @name = name.to_sym
8
8
  end
9
9
 
10
- @@run_modes = Hash.new {|h, k| h[k] = RunMode.new(k)}
11
-
12
10
  attr :name
13
11
 
14
12
  def self.[](name)
15
- @@run_modes[name]
13
+ @run_modes ||= {}
14
+ if Puppet.features.microsoft_windows?
15
+ @run_modes[name] ||= WindowsRunMode.new(name)
16
+ else
17
+ @run_modes[name] ||= UnixRunMode.new(name)
18
+ end
16
19
  end
17
20
 
18
21
  def master?
@@ -27,21 +30,6 @@ module Puppet
27
30
  name == :user
28
31
  end
29
32
 
30
-
31
- def conf_dir
32
- which_dir(
33
- Puppet::Settings.default_global_config_dir,
34
- Puppet::Settings.default_user_config_dir
35
- )
36
- end
37
-
38
- def var_dir
39
- which_dir(
40
- Puppet::Settings.default_global_var_dir,
41
- Puppet::Settings.default_user_var_dir
42
- )
43
- end
44
-
45
33
  def run_dir
46
34
  "$vardir/run"
47
35
  end
@@ -50,24 +38,48 @@ module Puppet
50
38
  "$vardir/log"
51
39
  end
52
40
 
53
- private
41
+ private
54
42
 
55
43
  def which_dir( global, user )
56
44
  #FIXME: we should test if we're user "puppet"
57
45
  # there's a comment that suggests that we do that
58
46
  # and we currently don't.
59
- expand_path case
60
- when name == :master; global
61
- when Puppet.features.root?; global
62
- else user
63
- end
47
+ File.expand_path(if in_global_context? then global else user end)
48
+ end
49
+
50
+ def in_global_context?
51
+ name == :master || Puppet.features.root?
52
+ end
53
+ end
54
+
55
+ class UnixRunMode < RunMode
56
+ def conf_dir
57
+ which_dir("/etc/puppet", "~/.puppet")
58
+ end
59
+
60
+ def var_dir
61
+ which_dir("/var/lib/puppet", "~/.puppet/var")
62
+ end
63
+ end
64
+
65
+ class WindowsRunMode < RunMode
66
+ def conf_dir
67
+ which_dir(File.join(windows_common_base("etc")), File.join(*windows_local_base))
64
68
  end
65
69
 
66
- def expand_path( dir )
67
- ENV["HOME"] ||= Etc.getpwuid(Process.uid).dir
68
- File.expand_path(dir)
70
+ def var_dir
71
+ which_dir(File.join(windows_common_base("var")), File.join(*windows_local_base("var")))
69
72
  end
70
73
 
74
+ private
75
+
76
+ def windows_common_base(*extra)
77
+ [Dir::COMMON_APPDATA, "PuppetLabs", "puppet"] + extra
78
+ end
79
+
80
+ def windows_local_base(*extra)
81
+ [Dir::LOCAL_APPDATA, "PuppetLabs", "puppet"] + extra
82
+ end
71
83
  end
72
84
  end
73
85
  end
@@ -1,5 +1,6 @@
1
1
  require 'yaml'
2
2
  require 'sync'
3
+ require 'singleton'
3
4
 
4
5
  # a class for storing state
5
6
  class Puppet::Util::Storage
@@ -6,7 +6,7 @@
6
6
  # Raketasks and such to set the version based on the output of `git describe`
7
7
  #
8
8
  module Puppet
9
- PUPPETVERSION = '3.0.0-rc4'
9
+ PUPPETVERSION = '3.0.0-rc5'
10
10
 
11
11
  def self.version
12
12
  @puppet_version || PUPPETVERSION
@@ -100,19 +100,21 @@ describe Puppet::Indirector::Hiera do
100
100
  end
101
101
 
102
102
  context "when the Hiera configuration file does not exist" do
103
+ let(:path) { File.expand_path('/doesnotexist') }
104
+
103
105
  before do
104
- Puppet.settings[:hiera_config] = '/doesnotexists'
106
+ Puppet.settings[:hiera_config] = path
105
107
  end
106
108
 
107
109
  it "should log a warning" do
108
110
  Puppet.expects(:warning).with(
109
- "Config file /doesnotexists not found, using Hiera defaults")
111
+ "Config file #{path} not found, using Hiera defaults")
110
112
  @hiera_class.hiera_config
111
113
  end
112
114
 
113
115
  it "should only configure the logger and set it to puppet" do
114
116
  Puppet.expects(:warning).with(
115
- "Config file /doesnotexists not found, using Hiera defaults")
117
+ "Config file #{path} not found, using Hiera defaults")
116
118
  @hiera_class.hiera_config.should == { :logger => 'puppet' }
117
119
  end
118
120
  end
@@ -2,17 +2,21 @@ require 'spec_helper'
2
2
  require 'puppet/module_tool/applications'
3
3
  require 'puppet_spec/modules'
4
4
 
5
- describe Puppet::ModuleTool::Applications::Searcher, :fails_on_windows => true do
5
+ describe Puppet::ModuleTool::Applications::Searcher do
6
6
  include PuppetSpec::Files
7
7
 
8
8
  describe "when searching" do
9
9
  let(:forge) { mock 'forge' }
10
+ let(:searcher) do
11
+ pending("porting to Windows", :if => Puppet.features.microsoft_windows?) do
12
+ described_class.new('search_term', forge)
13
+ end
14
+ end
10
15
 
11
16
  it "should return results from a forge query when successful" do
12
17
  results = 'mock results'
13
18
  forge.expects(:search).with('search_term').returns(results)
14
19
 
15
- searcher = Puppet::ModuleTool::Applications::Searcher.new('search_term', forge)
16
20
  search_result = searcher.run
17
21
  search_result.should == {
18
22
  :result => :success,
@@ -22,8 +26,7 @@ describe Puppet::ModuleTool::Applications::Searcher, :fails_on_windows => true d
22
26
 
23
27
  it "should return an error when the forge query throws an exception" do
24
28
  forge.expects(:search).with('search_term').raises Puppet::Forge::Errors::ForgeError.new("something went wrong")
25
-
26
- searcher = Puppet::ModuleTool::Applications::Searcher.new('search_term', forge)
29
+
27
30
  search_result = searcher.run
28
31
  search_result.should == {
29
32
  :result => :failure,
@@ -2,14 +2,16 @@ require 'spec_helper'
2
2
  require 'puppet/module_tool/applications'
3
3
  require 'puppet_spec/modules'
4
4
 
5
- describe Puppet::ModuleTool::Applications::Unpacker, :fails_on_windows => true do
5
+ describe Puppet::ModuleTool::Applications::Unpacker do
6
6
  include PuppetSpec::Files
7
7
 
8
8
  let(:target) { tmpdir("unpacker") }
9
9
 
10
10
  context "initialization" do
11
11
  it "should support filename and basic options" do
12
- Puppet::ModuleTool::Applications::Unpacker.new("myusername-mytarball-1.0.0.tar.gz", :target_dir => target)
12
+ pending("porting to Windows", :if => Puppet.features.microsoft_windows?) do
13
+ Puppet::ModuleTool::Applications::Unpacker.new("myusername-mytarball-1.0.0.tar.gz", :target_dir => target)
14
+ end
13
15
  end
14
16
 
15
17
  it "should raise ArgumentError when filename is invalid" do
@@ -22,7 +24,9 @@ describe Puppet::ModuleTool::Applications::Unpacker, :fails_on_windows => true d
22
24
  let(:filename) { tmpdir("module") + "/myusername-mytarball-1.0.0.tar.gz" }
23
25
  let(:build_dir) { Pathname.new(tmpdir("build_dir")) }
24
26
  let(:unpacker) do
25
- Puppet::ModuleTool::Applications::Unpacker.new(filename, :target_dir => target)
27
+ pending("porting to Windows", :if => Puppet.features.microsoft_windows?) do
28
+ Puppet::ModuleTool::Applications::Unpacker.new(filename, :target_dir => target)
29
+ end
26
30
  end
27
31
 
28
32
  before :each do
@@ -35,8 +39,10 @@ describe Puppet::ModuleTool::Applications::Unpacker, :fails_on_windows => true d
35
39
 
36
40
  context "on linux" do
37
41
  it "should attempt to untar file to temporary location using system tar" do
38
- Puppet::Util::Execution.expects(:execute).with("tar xzf #{filename} -C #{build_dir}").returns(true)
39
- unpacker.run
42
+ pending("porting to Windows", :if => Puppet.features.microsoft_windows?) do
43
+ Puppet::Util::Execution.expects(:execute).with("tar xzf #{filename} -C #{build_dir}").returns(true)
44
+ unpacker.run
45
+ end
40
46
  end
41
47
  end
42
48
 
@@ -190,7 +190,7 @@ describe Puppet::Type.type(:zpool).provider(:zpool) do
190
190
  context '#delete' do
191
191
  it "should call zpool with destroy and the pool name" do
192
192
  provider.expects(:zpool).with(:destroy, name)
193
- provider.delete
193
+ provider.destroy
194
194
  end
195
195
  end
196
196
 
@@ -6,20 +6,12 @@ require 'puppet/settings/errors'
6
6
  describe Puppet::Settings do
7
7
  include PuppetSpec::Files
8
8
 
9
- MAIN_CONFIG_FILE_DEFAULT_LOCATION = File.join(Puppet::Settings.default_global_config_dir, "puppet.conf")
10
- USER_CONFIG_FILE_DEFAULT_LOCATION = File.join(Puppet::Settings.default_user_config_dir, "puppet.conf")
9
+ let(:main_config_file_default_location) do
10
+ File.join(Puppet::Util::RunMode[:master].conf_dir, "puppet.conf")
11
+ end
11
12
 
12
- describe "when dealing with user default directories" do
13
- context "user config dir" do
14
- it "should expand the value to an absolute path" do
15
- Pathname.new(Puppet::Settings.default_user_config_dir).absolute?.should be_true
16
- end
17
- end
18
- context "user var dir" do
19
- it "should expand the value to an absolute path" do
20
- Pathname.new(Puppet::Settings.default_user_var_dir).absolute?.should be_true
21
- end
22
- end
13
+ let(:user_config_file_default_location) do
14
+ File.join(Puppet::Util::RunMode[:user].conf_dir, "puppet.conf")
23
15
  end
24
16
 
25
17
  describe "when specifying defaults" do
@@ -661,21 +653,21 @@ describe Puppet::Settings do
661
653
  end
662
654
 
663
655
  describe "when root" do
664
- it "should look for #{MAIN_CONFIG_FILE_DEFAULT_LOCATION} if config settings haven't been overridden'" do
656
+ it "should look for the main config file default location config settings haven't been overridden'" do
665
657
  Puppet.features.stubs(:root?).returns(true)
666
- FileTest.expects(:exist?).with(MAIN_CONFIG_FILE_DEFAULT_LOCATION).returns(false)
667
- FileTest.expects(:exist?).with(USER_CONFIG_FILE_DEFAULT_LOCATION).never
658
+ FileTest.expects(:exist?).with(main_config_file_default_location).returns(false)
659
+ FileTest.expects(:exist?).with(user_config_file_default_location).never
668
660
 
669
661
  @settings.send(:parse_config_files)
670
662
  end
671
663
  end
672
664
 
673
665
  describe "when not root" do
674
- it "should look for #{USER_CONFIG_FILE_DEFAULT_LOCATION} if config settings haven't been overridden'" do
666
+ it "should look for user config file default location if config settings haven't been overridden'" do
675
667
  Puppet.features.stubs(:root?).returns(false)
676
668
 
677
669
  seq = sequence "load config files"
678
- FileTest.expects(:exist?).with(USER_CONFIG_FILE_DEFAULT_LOCATION).returns(false).in_sequence(seq)
670
+ FileTest.expects(:exist?).with(user_config_file_default_location).returns(false).in_sequence(seq)
679
671
 
680
672
  @settings.send(:parse_config_files)
681
673
  end
@@ -895,10 +887,10 @@ describe Puppet::Settings do
895
887
  before :each do
896
888
  Puppet.features.stubs(:root?).returns(false)
897
889
  FileTest.expects(:exist?).
898
- with(USER_CONFIG_FILE_DEFAULT_LOCATION).
890
+ with(user_config_file_default_location).
899
891
  returns(true).in_sequence(seq)
900
892
  @settings.expects(:read_file).
901
- with(USER_CONFIG_FILE_DEFAULT_LOCATION).
893
+ with(user_config_file_default_location).
902
894
  returns(user_config_text).in_sequence(seq)
903
895
  end
904
896
 
@@ -917,10 +909,10 @@ describe Puppet::Settings do
917
909
  before :each do
918
910
  Puppet.features.stubs(:root?).returns(true)
919
911
  FileTest.expects(:exist?).
920
- with(MAIN_CONFIG_FILE_DEFAULT_LOCATION).
912
+ with(main_config_file_default_location).
921
913
  returns(true).in_sequence(seq)
922
914
  @settings.expects(:read_file).
923
- with(MAIN_CONFIG_FILE_DEFAULT_LOCATION).
915
+ with(main_config_file_default_location).
924
916
  returns(main_config_text).in_sequence(seq)
925
917
  end
926
918
 
@@ -938,12 +930,12 @@ describe Puppet::Settings do
938
930
  context "running with an explicit config file as a user (e.g. Apache + Passenger)" do
939
931
  before :each do
940
932
  Puppet.features.stubs(:root?).returns(false)
941
- @settings[:confdir] = File.dirname(MAIN_CONFIG_FILE_DEFAULT_LOCATION)
933
+ @settings[:confdir] = File.dirname(main_config_file_default_location)
942
934
  FileTest.expects(:exist?).
943
- with(MAIN_CONFIG_FILE_DEFAULT_LOCATION).
935
+ with(main_config_file_default_location).
944
936
  returns(true).in_sequence(seq)
945
937
  @settings.expects(:read_file).
946
- with(MAIN_CONFIG_FILE_DEFAULT_LOCATION).
938
+ with(main_config_file_default_location).
947
939
  returns(main_config_text).in_sequence(seq)
948
940
  end
949
941
 
@@ -6,44 +6,105 @@ describe Puppet::Util::RunMode do
6
6
  @run_mode = Puppet::Util::RunMode.new('fake')
7
7
  end
8
8
 
9
- it "should have confdir /etc/puppet when run as root" do
10
- Puppet.features.stubs(:root?).returns(true)
11
- etcdir = Puppet.features.microsoft_windows? ? File.join(Dir::COMMON_APPDATA, "PuppetLabs", "puppet", "etc") : '/etc/puppet'
12
- # REMIND: issue with windows backslashes
13
- @run_mode.conf_dir.should == File.expand_path(etcdir)
9
+ it "has rundir depend on vardir" do
10
+ @run_mode.run_dir.should == '$vardir/run'
14
11
  end
15
12
 
16
- it "should have confdir ~/.puppet when run as non-root" do
17
- Puppet.features.stubs(:root?).returns(false)
18
- @run_mode.conf_dir.should == File.expand_path("~/.puppet")
19
- end
13
+ describe Puppet::Util::UnixRunMode do
14
+ before do
15
+ @run_mode = Puppet::Util::UnixRunMode.new('fake')
16
+ end
20
17
 
21
- it "should have vardir /var/lib/puppet when run as root" do
22
- Puppet.features.stubs(:root?).returns(true)
23
- vardir = Puppet.features.microsoft_windows? ? File.join(Dir::COMMON_APPDATA, "PuppetLabs", "puppet", "var") : '/var/lib/puppet'
24
- # REMIND: issue with windows backslashes
25
- @run_mode.var_dir.should == File.expand_path(vardir)
26
- end
18
+ describe "#conf_dir" do
19
+ it "has confdir /etc/puppet when run as root" do
20
+ as_root { @run_mode.conf_dir.should == File.expand_path('/etc/puppet') }
21
+ end
27
22
 
28
- it "should have vardir ~/.puppet/var when run as non-root" do
29
- Puppet.features.stubs(:root?).returns(false)
30
- @run_mode.var_dir.should == File.expand_path("~/.puppet/var")
23
+ it "has confdir ~/.puppet when run as non-root" do
24
+ as_non_root { @run_mode.conf_dir.should == File.expand_path('~/.puppet') }
25
+ end
26
+
27
+ it "fails when asking for the conf_dir as non-root and there is no $HOME" do
28
+ as_non_root do
29
+ without_home do
30
+ expect { @run_mode.conf_dir }.to raise_error ArgumentError, /couldn't find HOME/
31
+ end
32
+ end
33
+ end
34
+ end
35
+
36
+ describe "#var_dir" do
37
+ it "has vardir /var/lib/puppet when run as root" do
38
+ as_root { @run_mode.var_dir.should == File.expand_path('/var/lib/puppet') }
39
+ end
40
+
41
+ it "has vardir ~/.puppet/var when run as non-root" do
42
+ as_non_root { @run_mode.var_dir.should == File.expand_path('~/.puppet/var') }
43
+ end
44
+
45
+ it "fails when asking for the var_dir as non-root and there is no $HOME" do
46
+ as_non_root do
47
+ without_home do
48
+ expect { @run_mode.var_dir }.to raise_error ArgumentError, /couldn't find HOME/
49
+ end
50
+ end
51
+ end
52
+ end
53
+
54
+ def without_home
55
+ saved_home = ENV["HOME"]
56
+ ENV.delete "HOME"
57
+ yield
58
+ ensure
59
+ ENV["HOME"] = saved_home
60
+ end
31
61
  end
32
62
 
33
- it "should have rundir depend on vardir" do
34
- @run_mode.run_dir.should == '$vardir/run'
63
+ describe Puppet::Util::WindowsRunMode do
64
+ before do
65
+ if not Dir.const_defined? :COMMON_APPDATA
66
+ Dir.const_set :COMMON_APPDATA, "/CommonFakeBase"
67
+ Dir.const_set :LOCAL_APPDATA, "/LocalFakeBase"
68
+ @remove_const = true
69
+ end
70
+ @run_mode = Puppet::Util::WindowsRunMode.new('fake')
71
+ end
72
+
73
+ after do
74
+ if @remove_const
75
+ Dir.send :remove_const, :COMMON_APPDATA
76
+ Dir.send :remove_const, :LOCAL_APPDATA
77
+ end
78
+ end
79
+
80
+ describe "#conf_dir" do
81
+ it "has confdir /etc/puppet when run as root" do
82
+ as_root { @run_mode.conf_dir.should == File.expand_path(File.join(Dir::COMMON_APPDATA, "PuppetLabs", "puppet", "etc")) }
83
+ end
84
+
85
+ it "has confdir in the local appdata when run as non-root" do
86
+ as_non_root { @run_mode.conf_dir.should == File.expand_path(File.join(Dir::LOCAL_APPDATA, "PuppetLabs", "puppet")) }
87
+ end
88
+ end
89
+
90
+ describe "#var_dir" do
91
+ it "has vardir /var/lib/puppet when run as root" do
92
+ as_root { @run_mode.var_dir.should == File.expand_path(File.join(Dir::COMMON_APPDATA, "PuppetLabs", "puppet", "var")) }
93
+ end
94
+
95
+ it "has vardir local appdata when run as non-root" do
96
+ as_non_root { @run_mode.var_dir.should == File.expand_path(File.join(Dir::LOCAL_APPDATA, "PuppetLabs", "puppet", "var")) }
97
+ end
98
+ end
35
99
  end
36
100
 
101
+ def as_root
102
+ Puppet.features.stubs(:root?).returns(true)
103
+ yield
104
+ end
37
105
 
38
- it "should have logopts return a hash with $vardir/log and other metadata if runmode is master" do
39
- pending("runmode.logopts functionality is being moved")
40
- @run_mode.expects(:master?).returns true
41
- @run_mode.logopts.should == {
42
- :default => "$vardir/log",
43
- :mode => 0750,
44
- :owner => "service",
45
- :group => "service",
46
- :desc => "The Puppet log directory.",
47
- }
106
+ def as_non_root
107
+ Puppet.features.stubs(:root?).returns(false)
108
+ yield
48
109
  end
49
110
  end
metadata CHANGED
@@ -1,83 +1,71 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: puppet
3
- version: !ruby/object:Gem::Version
4
- hash: 2904133441
3
+ version: !ruby/object:Gem::Version
4
+ version: 3.0.0.rc5
5
5
  prerelease: 6
6
- segments:
7
- - 3
8
- - 0
9
- - 0
10
- - rc
11
- - 4
12
- version: 3.0.0.rc4
13
6
  platform: ruby
14
- authors:
7
+ authors:
15
8
  - Puppet Labs
16
9
  autorequire:
17
10
  bindir: bin
18
11
  cert_chain: []
19
-
20
- date: 2012-08-24 00:00:00 Z
21
- dependencies:
22
- - !ruby/object:Gem::Dependency
12
+ date: 2012-08-29 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
23
15
  name: facter
24
- prerelease: false
25
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
26
17
  none: false
27
- requirements:
28
- - - ">="
29
- - !ruby/object:Gem::Version
30
- hash: 25
31
- segments:
32
- - 1
33
- - 6
34
- - 11
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
35
21
  version: 1.6.11
36
22
  type: :runtime
37
- version_requirements: *id001
38
- - !ruby/object:Gem::Dependency
39
- name: hiera
40
23
  prerelease: false
41
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 1.6.11
30
+ - !ruby/object:Gem::Dependency
31
+ name: hiera
32
+ requirement: !ruby/object:Gem::Requirement
42
33
  none: false
43
- requirements:
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- hash: 1452066708
47
- segments:
48
- - 1
49
- - 0
50
- - 0
51
- - rc
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
52
37
  version: 1.0.0rc
53
38
  type: :runtime
54
- version_requirements: *id002
55
- - !ruby/object:Gem::Dependency
56
- name: hiera-puppet
57
39
  prerelease: false
58
- requirement: &id003 !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
59
41
  none: false
60
- requirements:
61
- - - ">="
62
- - !ruby/object:Gem::Version
63
- hash: 1452066708
64
- segments:
65
- - 1
66
- - 0
67
- - 0
68
- - rc
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 1.0.0rc
46
+ - !ruby/object:Gem::Dependency
47
+ name: hiera-puppet
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
69
53
  version: 1.0.0rc
70
54
  type: :runtime
71
- version_requirements: *id003
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 1.0.0rc
72
62
  description: Puppet, an automated configuration management tool
73
63
  email: puppet@puppetlabs.com
74
- executables:
64
+ executables:
75
65
  - puppet
76
66
  extensions: []
77
-
78
67
  extra_rdoc_files: []
79
-
80
- files:
68
+ files:
81
69
  - CHANGELOG
82
70
  - CONTRIBUTING.md
83
71
  - Gemfile
@@ -1746,42 +1734,31 @@ files:
1746
1734
  - spec/watchr.rb
1747
1735
  homepage: http://puppetlabs.com
1748
1736
  licenses: []
1749
-
1750
1737
  post_install_message:
1751
- rdoc_options:
1738
+ rdoc_options:
1752
1739
  - --title
1753
1740
  - Puppet - Configuration Management
1754
1741
  - --main
1755
1742
  - README
1756
1743
  - --line-numbers
1757
- require_paths:
1744
+ require_paths:
1758
1745
  - lib
1759
- required_ruby_version: !ruby/object:Gem::Requirement
1746
+ required_ruby_version: !ruby/object:Gem::Requirement
1760
1747
  none: false
1761
- requirements:
1762
- - - ">="
1763
- - !ruby/object:Gem::Version
1764
- hash: 3
1765
- segments:
1766
- - 0
1767
- version: "0"
1768
- required_rubygems_version: !ruby/object:Gem::Requirement
1748
+ requirements:
1749
+ - - ! '>='
1750
+ - !ruby/object:Gem::Version
1751
+ version: '0'
1752
+ required_rubygems_version: !ruby/object:Gem::Requirement
1769
1753
  none: false
1770
- requirements:
1771
- - - ">"
1772
- - !ruby/object:Gem::Version
1773
- hash: 25
1774
- segments:
1775
- - 1
1776
- - 3
1777
- - 1
1754
+ requirements:
1755
+ - - ! '>'
1756
+ - !ruby/object:Gem::Version
1778
1757
  version: 1.3.1
1779
1758
  requirements: []
1780
-
1781
1759
  rubyforge_project: puppet
1782
1760
  rubygems_version: 1.8.24
1783
1761
  signing_key:
1784
1762
  specification_version: 3
1785
1763
  summary: Puppet, an automated configuration management tool
1786
1764
  test_files: []
1787
-