puppet 6.18.0-x64-mingw32 → 6.19.0-x64-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Gemfile.lock +8 -10
- data/README.md +1 -2
- data/Rakefile +4 -12
- data/lib/puppet/agent/locker.rb +0 -7
- data/lib/puppet/application/agent.rb +8 -3
- data/lib/puppet/application/doc.rb +1 -1
- data/lib/puppet/application/lookup.rb +5 -5
- data/lib/puppet/configurer.rb +39 -7
- data/lib/puppet/defaults.rb +55 -29
- data/lib/puppet/environments.rb +51 -10
- data/lib/puppet/face/catalog.rb +1 -1
- data/lib/puppet/face/config.rb +46 -16
- data/lib/puppet/face/node.rb +3 -3
- data/lib/puppet/face/node/clean.rb +2 -2
- data/lib/puppet/face/status.rb +1 -1
- data/lib/puppet/file_bucket/dipper.rb +1 -1
- data/lib/puppet/functions/new.rb +8 -3
- data/lib/puppet/http.rb +1 -0
- data/lib/puppet/http/client.rb +1 -1
- data/lib/puppet/http/resolver.rb +5 -8
- data/lib/puppet/http/resolver/server_list.rb +18 -36
- data/lib/puppet/http/resolver/settings.rb +4 -4
- data/lib/puppet/http/resolver/srv.rb +5 -5
- data/lib/puppet/http/service.rb +3 -1
- data/lib/puppet/http/service/compiler.rb +1 -1
- data/lib/puppet/http/service/file_server.rb +1 -1
- data/lib/puppet/http/service/puppetserver.rb +39 -0
- data/lib/puppet/http/session.rb +5 -4
- data/lib/puppet/indirector/catalog/compiler.rb +1 -1
- data/lib/puppet/indirector/facts/yaml.rb +1 -1
- data/lib/puppet/indirector/json.rb +1 -1
- data/lib/puppet/indirector/msgpack.rb +1 -1
- data/lib/puppet/indirector/request.rb +4 -4
- data/lib/puppet/indirector/yaml.rb +1 -1
- data/lib/puppet/network/http/api/master/v3/environments.rb +0 -1
- data/lib/puppet/node/facts.rb +17 -0
- data/lib/puppet/pops/evaluator/collectors/abstract_collector.rb +1 -3
- data/lib/puppet/pops/evaluator/runtime3_converter.rb +2 -2
- data/lib/puppet/pops/types/p_meta_type.rb +1 -1
- data/lib/puppet/pops/types/p_type_set_type.rb +4 -0
- data/lib/puppet/provider/package/dpkg.rb +1 -1
- data/lib/puppet/provider/package/pip2.rb +17 -0
- data/lib/puppet/provider/package/puppetserver_gem.rb +180 -0
- data/lib/puppet/provider/package/yum.rb +1 -0
- data/lib/puppet/resource/type.rb +2 -1
- data/lib/puppet/rest/route.rb +2 -2
- data/lib/puppet/settings.rb +19 -5
- data/lib/puppet/transaction/report.rb +11 -7
- data/lib/puppet/type/file/source.rb +1 -1
- data/lib/puppet/type/filebucket.rb +1 -1
- data/lib/puppet/util/connection.rb +8 -8
- data/lib/puppet/util/run_mode.rb +5 -1
- data/lib/puppet/version.rb +1 -1
- data/locales/puppet.pot +153 -156
- data/man/man5/puppet.conf.5 +29 -13
- data/man/man8/puppet-agent.8 +6 -3
- data/man/man8/puppet-apply.8 +1 -1
- data/man/man8/puppet-catalog.8 +1 -1
- data/man/man8/puppet-config.8 +6 -6
- data/man/man8/puppet-describe.8 +1 -1
- data/man/man8/puppet-device.8 +1 -1
- data/man/man8/puppet-doc.8 +1 -1
- data/man/man8/puppet-epp.8 +1 -1
- data/man/man8/puppet-facts.8 +1 -1
- data/man/man8/puppet-filebucket.8 +1 -1
- data/man/man8/puppet-generate.8 +1 -1
- data/man/man8/puppet-help.8 +1 -1
- data/man/man8/puppet-key.8 +1 -1
- data/man/man8/puppet-lookup.8 +1 -1
- data/man/man8/puppet-man.8 +1 -1
- data/man/man8/puppet-module.8 +1 -1
- data/man/man8/puppet-node.8 +4 -4
- data/man/man8/puppet-parser.8 +1 -1
- data/man/man8/puppet-plugin.8 +1 -1
- data/man/man8/puppet-report.8 +1 -1
- data/man/man8/puppet-resource.8 +1 -1
- data/man/man8/puppet-script.8 +1 -1
- data/man/man8/puppet-ssl.8 +1 -1
- data/man/man8/puppet-status.8 +2 -2
- data/man/man8/puppet.8 +2 -2
- data/spec/fixtures/unit/provider/package/puppetserver_gem/gem-list-local-packages +30 -0
- data/spec/integration/application/agent_spec.rb +23 -19
- data/spec/integration/application/filebucket_spec.rb +7 -7
- data/spec/integration/application/plugin_spec.rb +3 -3
- data/spec/integration/configurer_spec.rb +14 -0
- data/spec/integration/defaults_spec.rb +26 -1
- data/spec/integration/util/windows/adsi_spec.rb +2 -2
- data/spec/shared_contexts/types_setup.rb +2 -0
- data/spec/unit/application/doc_spec.rb +2 -2
- data/spec/unit/application/facts_spec.rb +3 -1
- data/spec/unit/application_spec.rb +9 -4
- data/spec/unit/configurer_spec.rb +39 -6
- data/spec/unit/environments_spec.rb +99 -32
- data/spec/unit/face/config_spec.rb +56 -0
- data/spec/unit/face/node_spec.rb +2 -2
- data/spec/unit/file_system_spec.rb +1 -2
- data/spec/unit/http/resolver_spec.rb +24 -4
- data/spec/unit/http/service/ca_spec.rb +2 -2
- data/spec/unit/http/service/compiler_spec.rb +2 -2
- data/spec/unit/http/service/file_server_spec.rb +2 -2
- data/spec/unit/http/service/puppetserver_spec.rb +82 -0
- data/spec/unit/http/service/report_spec.rb +2 -2
- data/spec/unit/http/session_spec.rb +8 -20
- data/spec/unit/indirector/catalog/json_spec.rb +1 -1
- data/spec/unit/indirector/catalog/rest_spec.rb +1 -1
- data/spec/unit/indirector/facts/rest_spec.rb +1 -1
- data/spec/unit/indirector/json_spec.rb +8 -8
- data/spec/unit/indirector/msgpack_spec.rb +8 -8
- data/spec/unit/indirector/node/rest_spec.rb +1 -1
- data/spec/unit/indirector/request_spec.rb +4 -4
- data/spec/unit/indirector/rest_spec.rb +1 -1
- data/spec/unit/indirector/status/rest_spec.rb +1 -1
- data/spec/unit/indirector/yaml_spec.rb +7 -7
- data/spec/unit/network/http/api/master/v3/environments_spec.rb +12 -23
- data/spec/unit/provider/exec_spec.rb +4 -3
- data/spec/unit/provider/package/dpkg_spec.rb +22 -7
- data/spec/unit/provider/package/openbsd_spec.rb +2 -0
- data/spec/unit/provider/package/pip2_spec.rb +36 -0
- data/spec/unit/provider/package/puppetserver_gem_spec.rb +137 -0
- data/spec/unit/provider/package/yum_spec.rb +31 -0
- data/spec/unit/provider/service/base_spec.rb +2 -4
- data/spec/unit/provider/service/bsd_spec.rb +5 -1
- data/spec/unit/provider/service/daemontools_spec.rb +1 -1
- data/spec/unit/provider/service/debian_spec.rb +3 -5
- data/spec/unit/provider/service/freebsd_spec.rb +1 -1
- data/spec/unit/provider/service/gentoo_spec.rb +4 -5
- data/spec/unit/provider/service/init_spec.rb +4 -5
- data/spec/unit/provider/service/launchd_spec.rb +5 -6
- data/spec/unit/provider/service/openrc_spec.rb +4 -5
- data/spec/unit/provider/service/openwrt_spec.rb +1 -1
- data/spec/unit/provider/service/redhat_spec.rb +1 -1
- data/spec/unit/provider/service/runit_spec.rb +2 -1
- data/spec/unit/provider/service/smf_spec.rb +1 -1
- data/spec/unit/provider/service/src_spec.rb +3 -5
- data/spec/unit/provider/service/systemd_spec.rb +3 -1
- data/spec/unit/provider/service/upstart_spec.rb +4 -5
- data/spec/unit/rest/route_spec.rb +4 -4
- data/spec/unit/settings_spec.rb +44 -22
- data/spec/unit/transaction/report_spec.rb +2 -0
- data/spec/unit/type/file/source_spec.rb +1 -1
- data/spec/unit/type/filebucket_spec.rb +1 -1
- data/spec/unit/util/run_mode_spec.rb +6 -6
- metadata +13 -2
| @@ -26,9 +26,9 @@ describe Puppet::HTTP::Session do | |
| 26 26 | 
             
                  @count = 0
         | 
| 27 27 | 
             
                end
         | 
| 28 28 |  | 
| 29 | 
            -
                def resolve(session, name, ssl_context: nil,  | 
| 29 | 
            +
                def resolve(session, name, ssl_context: nil, canceled_handler: nil)
         | 
| 30 30 | 
             
                  @count += 1
         | 
| 31 | 
            -
                  return @service if check_connection?(session, @service, ssl_context: ssl_context | 
| 31 | 
            +
                  return @service if check_connection?(session, @service, ssl_context: ssl_context)
         | 
| 32 32 | 
             
                end
         | 
| 33 33 | 
             
              end
         | 
| 34 34 |  | 
| @@ -67,19 +67,8 @@ describe Puppet::HTTP::Session do | |
| 67 67 | 
             
                    session.route_to(:ca)
         | 
| 68 68 | 
             
                  }.to raise_error(Puppet::HTTP::RouteError, 'No more routes to ca')
         | 
| 69 69 |  | 
| 70 | 
            -
                  expect(@logs).to include(an_object_having_attributes(level: :err, message: "whoops1"),
         | 
| 71 | 
            -
                                           an_object_having_attributes(level: :err, message: "whoops2"))
         | 
| 72 | 
            -
                end
         | 
| 73 | 
            -
             | 
| 74 | 
            -
                it 'logs routing failures as debug until routing succeeds' do
         | 
| 75 | 
            -
                  Puppet[:log_level] = 'debug'
         | 
| 76 | 
            -
             | 
| 77 | 
            -
                  resolvers = [DummyResolver.new(bad_service), DummyResolver.new(good_service)]
         | 
| 78 | 
            -
                  session = described_class.new(client, resolvers)
         | 
| 79 | 
            -
                  session.route_to(:ca)
         | 
| 80 | 
            -
             | 
| 81 | 
            -
                  expect(@logs).to include(an_object_having_attributes(level: :debug, message: "Connection to #{uri} failed, trying next route: whoops"))
         | 
| 82 | 
            -
                  expect(@logs).to_not include(an_object_having_attributes(level: :err))
         | 
| 70 | 
            +
                  expect(@logs).to include(an_object_having_attributes(level: :err, message: "Connection to #{uri} failed, trying next route: whoops1"),
         | 
| 71 | 
            +
                                           an_object_having_attributes(level: :err, message: "Connection to #{uri} failed, trying next route: whoops2"))
         | 
| 83 72 | 
             
                end
         | 
| 84 73 |  | 
| 85 74 | 
             
                it 'accepts an ssl context to use when connecting' do
         | 
| @@ -167,16 +156,15 @@ describe Puppet::HTTP::Session do | |
| 167 156 | 
             
                  expect(service.url).to eq(URI("https://bar.example.com:8140/puppet-ca/v1"))
         | 
| 168 157 | 
             
                end
         | 
| 169 158 |  | 
| 170 | 
            -
                it " | 
| 171 | 
            -
                  Puppet[:server_list] = 'foo.example.com | 
| 159 | 
            +
                it "does not fallback from server_list to the settings resolver when server_list is exhausted" do
         | 
| 160 | 
            +
                  Puppet[:server_list] = 'foo.example.com'
         | 
| 172 161 |  | 
| 173 | 
            -
                   | 
| 162 | 
            +
                  expect_any_instance_of(Puppet::HTTP::Resolver::Settings).to receive(:resolve).never
         | 
| 174 163 | 
             
                  stub_request(:get, "https://foo.example.com:8140/status/v1/simple/master").to_return(status: 500)
         | 
| 175 | 
            -
                  stub_request(:get, "https://bar.example.com:8140/status/v1/simple/master").to_return(status: 500)
         | 
| 176 164 |  | 
| 177 165 | 
             
                  expect {
         | 
| 178 166 | 
             
                    session.route_to(:ca)
         | 
| 179 | 
            -
                  }.to raise_error(Puppet:: | 
| 167 | 
            +
                  }.to raise_error(Puppet::HTTP::RouteError, "No more routes to ca")
         | 
| 180 168 | 
             
                end
         | 
| 181 169 |  | 
| 182 170 | 
             
                it "raises when there are no more routes" do
         | 
| @@ -24,7 +24,7 @@ describe Puppet::Resource::Catalog::Json do | |
| 24 24 | 
             
                end
         | 
| 25 25 |  | 
| 26 26 | 
             
                before :each do
         | 
| 27 | 
            -
                  allow(Puppet.run_mode).to receive(: | 
| 27 | 
            +
                  allow(Puppet.run_mode).to receive(:server?).and_return(true)
         | 
| 28 28 | 
             
                  Puppet[:server_datadir] = tmpdir('jsondir')
         | 
| 29 29 | 
             
                  FileUtils.mkdir_p(File.join(Puppet[:server_datadir], 'indirector_testing'))
         | 
| 30 30 | 
             
                  Puppet.push_context(:loaders => Puppet::Pops::Loaders.new(env))
         | 
| @@ -11,24 +11,24 @@ describe Puppet::Indirector::JSON do | |
| 11 11 |  | 
| 12 12 | 
             
              context "#path" do
         | 
| 13 13 | 
             
                before :each do
         | 
| 14 | 
            -
                  Puppet[:server_datadir] = '/sample/datadir/ | 
| 14 | 
            +
                  Puppet[:server_datadir] = '/sample/datadir/server'
         | 
| 15 15 | 
             
                  Puppet[:client_datadir] = '/sample/datadir/client'
         | 
| 16 16 | 
             
                end
         | 
| 17 17 |  | 
| 18 | 
            -
                it "uses the :server_datadir setting if this is the  | 
| 19 | 
            -
                  allow(Puppet.run_mode).to receive(: | 
| 18 | 
            +
                it "uses the :server_datadir setting if this is the server" do
         | 
| 19 | 
            +
                  allow(Puppet.run_mode).to receive(:server?).and_return(true)
         | 
| 20 20 | 
             
                  expected = File.join(Puppet[:server_datadir], 'indirector_testing', 'testing.json')
         | 
| 21 21 | 
             
                  expect(subject.path('testing')).to eq(expected)
         | 
| 22 22 | 
             
                end
         | 
| 23 23 |  | 
| 24 | 
            -
                it "uses the :client_datadir setting if this is not the  | 
| 25 | 
            -
                  allow(Puppet.run_mode).to receive(: | 
| 24 | 
            +
                it "uses the :client_datadir setting if this is not the server" do
         | 
| 25 | 
            +
                  allow(Puppet.run_mode).to receive(:server?).and_return(false)
         | 
| 26 26 | 
             
                  expected = File.join(Puppet[:client_datadir], 'indirector_testing', 'testing.json')
         | 
| 27 27 | 
             
                  expect(subject.path('testing')).to eq(expected)
         | 
| 28 28 | 
             
                end
         | 
| 29 29 |  | 
| 30 30 | 
             
                it "overrides the default extension with a supplied value" do
         | 
| 31 | 
            -
                  allow(Puppet.run_mode).to receive(: | 
| 31 | 
            +
                  allow(Puppet.run_mode).to receive(:server?).and_return(true)
         | 
| 32 32 | 
             
                  expected = File.join(Puppet[:server_datadir], 'indirector_testing', 'testing.not-json')
         | 
| 33 33 | 
             
                  expect(subject.path('testing', '.not-json')).to eq(expected)
         | 
| 34 34 | 
             
                end
         | 
| @@ -50,7 +50,7 @@ describe Puppet::Indirector::JSON do | |
| 50 50 |  | 
| 51 51 | 
             
              context "handling requests" do
         | 
| 52 52 | 
             
                before :each do
         | 
| 53 | 
            -
                  allow(Puppet.run_mode).to receive(: | 
| 53 | 
            +
                  allow(Puppet.run_mode).to receive(:server?).and_return(true)
         | 
| 54 54 | 
             
                  Puppet[:server_datadir] = tmpdir('jsondir')
         | 
| 55 55 | 
             
                  FileUtils.mkdir_p(File.join(Puppet[:server_datadir], 'indirector_testing'))
         | 
| 56 56 | 
             
                end
         | 
| @@ -158,7 +158,7 @@ describe Puppet::Indirector::JSON do | |
| 158 158 |  | 
| 159 159 | 
             
              context "#search" do
         | 
| 160 160 | 
             
                before :each do
         | 
| 161 | 
            -
                  allow(Puppet.run_mode).to receive(: | 
| 161 | 
            +
                  allow(Puppet.run_mode).to receive(:server?).and_return(true)
         | 
| 162 162 | 
             
                  Puppet[:server_datadir] = tmpdir('jsondir')
         | 
| 163 163 | 
             
                  FileUtils.mkdir_p(File.join(Puppet[:server_datadir], 'indirector_testing'))
         | 
| 164 164 | 
             
                end
         | 
| @@ -11,24 +11,24 @@ describe Puppet::Indirector::Msgpack, :if => Puppet.features.msgpack? do | |
| 11 11 |  | 
| 12 12 | 
             
              context "#path" do
         | 
| 13 13 | 
             
                before :each do
         | 
| 14 | 
            -
                  Puppet[:server_datadir] = '/sample/datadir/ | 
| 14 | 
            +
                  Puppet[:server_datadir] = '/sample/datadir/server'
         | 
| 15 15 | 
             
                  Puppet[:client_datadir] = '/sample/datadir/client'
         | 
| 16 16 | 
             
                end
         | 
| 17 17 |  | 
| 18 | 
            -
                it "uses the :server_datadir setting if this is the  | 
| 19 | 
            -
                  allow(Puppet.run_mode).to receive(: | 
| 18 | 
            +
                it "uses the :server_datadir setting if this is the server" do
         | 
| 19 | 
            +
                  allow(Puppet.run_mode).to receive(:server?).and_return(true)
         | 
| 20 20 | 
             
                  expected = File.join(Puppet[:server_datadir], 'indirector_testing', 'testing.msgpack')
         | 
| 21 21 | 
             
                  expect(subject.path('testing')).to eq(expected)
         | 
| 22 22 | 
             
                end
         | 
| 23 23 |  | 
| 24 | 
            -
                it "uses the :client_datadir setting if this is not the  | 
| 25 | 
            -
                  allow(Puppet.run_mode).to receive(: | 
| 24 | 
            +
                it "uses the :client_datadir setting if this is not the server" do
         | 
| 25 | 
            +
                  allow(Puppet.run_mode).to receive(:server?).and_return(false)
         | 
| 26 26 | 
             
                  expected = File.join(Puppet[:client_datadir], 'indirector_testing', 'testing.msgpack')
         | 
| 27 27 | 
             
                  expect(subject.path('testing')).to eq(expected)
         | 
| 28 28 | 
             
                end
         | 
| 29 29 |  | 
| 30 30 | 
             
                it "overrides the default extension with a supplied value" do
         | 
| 31 | 
            -
                  allow(Puppet.run_mode).to receive(: | 
| 31 | 
            +
                  allow(Puppet.run_mode).to receive(:server?).and_return(true)
         | 
| 32 32 | 
             
                  expected = File.join(Puppet[:server_datadir], 'indirector_testing', 'testing.not-msgpack')
         | 
| 33 33 | 
             
                  expect(subject.path('testing', '.not-msgpack')).to eq(expected)
         | 
| 34 34 | 
             
                end
         | 
| @@ -50,7 +50,7 @@ describe Puppet::Indirector::Msgpack, :if => Puppet.features.msgpack? do | |
| 50 50 |  | 
| 51 51 | 
             
              context "handling requests" do
         | 
| 52 52 | 
             
                before :each do
         | 
| 53 | 
            -
                  allow(Puppet.run_mode).to receive(: | 
| 53 | 
            +
                  allow(Puppet.run_mode).to receive(:server?).and_return(true)
         | 
| 54 54 | 
             
                  Puppet[:server_datadir] = tmpdir('msgpackdir')
         | 
| 55 55 | 
             
                  FileUtils.mkdir_p(File.join(Puppet[:server_datadir], 'indirector_testing'))
         | 
| 56 56 | 
             
                end
         | 
| @@ -158,7 +158,7 @@ describe Puppet::Indirector::Msgpack, :if => Puppet.features.msgpack? do | |
| 158 158 |  | 
| 159 159 | 
             
              context "#search" do
         | 
| 160 160 | 
             
                before :each do
         | 
| 161 | 
            -
                  allow(Puppet.run_mode).to receive(: | 
| 161 | 
            +
                  allow(Puppet.run_mode).to receive(:server?).and_return(true)
         | 
| 162 162 | 
             
                  Puppet[:server_datadir] = tmpdir('msgpackdir')
         | 
| 163 163 | 
             
                  FileUtils.mkdir_p(File.join(Puppet[:server_datadir], 'indirector_testing'))
         | 
| 164 164 | 
             
                end
         | 
| @@ -126,8 +126,8 @@ describe Puppet::Indirector::Request do | |
| 126 126 | 
             
                    expect(Puppet::Indirector::Request.new(:ind, :method, "http://host:543/", nil).port).to eq(543)
         | 
| 127 127 | 
             
                  end
         | 
| 128 128 |  | 
| 129 | 
            -
                  it "should default to the  | 
| 130 | 
            -
                    Puppet[: | 
| 129 | 
            +
                  it "should default to the serverport if the URI scheme is 'puppet'" do
         | 
| 130 | 
            +
                    Puppet[:serverport] = "321"
         | 
| 131 131 | 
             
                    expect(Puppet::Indirector::Request.new(:ind, :method, "puppet://host/", nil).port).to eq(321)
         | 
| 132 132 | 
             
                  end
         | 
| 133 133 |  | 
| @@ -534,7 +534,7 @@ describe Puppet::Indirector::Request do | |
| 534 534 | 
             
                      expect(request.server).to be_nil
         | 
| 535 535 | 
             
                      expect(request.port).to be_nil
         | 
| 536 536 | 
             
                      expect(Puppet.settings[:server]).not_to be_nil
         | 
| 537 | 
            -
                      expect(Puppet.settings[: | 
| 537 | 
            +
                      expect(Puppet.settings[:serverport]).not_to be_nil
         | 
| 538 538 | 
             
                    end
         | 
| 539 539 | 
             
                  end
         | 
| 540 540 | 
             
                end
         | 
| @@ -552,7 +552,7 @@ describe Puppet::Indirector::Request do | |
| 552 552 | 
             
                  req = Puppet::Indirector::Request.new('node', 'find', 'localhost', nil)
         | 
| 553 553 | 
             
                  req.do_request() do |request|
         | 
| 554 554 | 
             
                    expect(request.server).to eq(Puppet.settings[:server])
         | 
| 555 | 
            -
                    expect(request.port).to eq(Puppet.settings[: | 
| 555 | 
            +
                    expect(request.port).to eq(Puppet.settings[:serverport])
         | 
| 556 556 | 
             
                  end
         | 
| 557 557 | 
             
                end
         | 
| 558 558 | 
             
              end
         | 
| @@ -249,7 +249,7 @@ describe Puppet::Indirector::REST do | |
| 249 249 |  | 
| 250 250 | 
             
              it "should default to :port for the port setting" do
         | 
| 251 251 | 
             
                expect(terminus_class).to receive(:port_setting).and_return(nil)
         | 
| 252 | 
            -
                Puppet[: | 
| 252 | 
            +
                Puppet[:serverport] = "543"
         | 
| 253 253 | 
             
                expect(terminus_class.port).to eq(543)
         | 
| 254 254 | 
             
              end
         | 
| 255 255 |  | 
| @@ -38,30 +38,30 @@ describe Puppet::Indirector::Yaml do | |
| 38 38 |  | 
| 39 39 | 
             
              before :each do
         | 
| 40 40 | 
             
                Puppet[:clientyamldir] = dir
         | 
| 41 | 
            -
                allow(Puppet.run_mode).to receive(: | 
| 41 | 
            +
                allow(Puppet.run_mode).to receive(:server?).and_return(false)
         | 
| 42 42 | 
             
              end
         | 
| 43 43 |  | 
| 44 44 | 
             
              describe "when choosing file location" do
         | 
| 45 | 
            -
                it "should use the server_datadir if the run_mode is  | 
| 46 | 
            -
                  allow(Puppet.run_mode).to receive(: | 
| 45 | 
            +
                it "should use the server_datadir if the run_mode is server" do
         | 
| 46 | 
            +
                  allow(Puppet.run_mode).to receive(:server?).and_return(true)
         | 
| 47 47 | 
             
                  Puppet[:yamldir] = serverdir
         | 
| 48 48 | 
             
                  expect(terminus.path(:me)).to match(/^#{serverdir}/)
         | 
| 49 49 | 
             
                end
         | 
| 50 50 |  | 
| 51 | 
            -
                it "should use the client yamldir if the run_mode is not  | 
| 52 | 
            -
                  allow(Puppet.run_mode).to receive(: | 
| 51 | 
            +
                it "should use the client yamldir if the run_mode is not server" do
         | 
| 52 | 
            +
                  allow(Puppet.run_mode).to receive(:server?).and_return(false)
         | 
| 53 53 | 
             
                  Puppet[:clientyamldir] = clientdir
         | 
| 54 54 | 
             
                  expect(terminus.path(:me)).to match(/^#{clientdir}/)
         | 
| 55 55 | 
             
                end
         | 
| 56 56 |  | 
| 57 57 | 
             
                it "should use the extension if one is specified" do
         | 
| 58 | 
            -
                  allow(Puppet.run_mode).to receive(: | 
| 58 | 
            +
                  allow(Puppet.run_mode).to receive(:server?).and_return(true)
         | 
| 59 59 | 
             
                  Puppet[:yamldir] = serverdir
         | 
| 60 60 | 
             
                  expect(terminus.path(:me,'.farfignewton')).to match(%r{\.farfignewton$})
         | 
| 61 61 | 
             
                end
         | 
| 62 62 |  | 
| 63 63 | 
             
                it "should assume an extension of .yaml if none is specified" do
         | 
| 64 | 
            -
                  allow(Puppet.run_mode).to receive(: | 
| 64 | 
            +
                  allow(Puppet.run_mode).to receive(:server?).and_return(true)
         | 
| 65 65 | 
             
                  Puppet[:yamldir] = serverdir
         | 
| 66 66 | 
             
                  expect(terminus.path(:me)).to match(%r{\.yaml$})
         | 
| 67 67 | 
             
                end
         | 
| @@ -7,13 +7,14 @@ require 'matchers/json' | |
| 7 7 | 
             
            describe Puppet::Network::HTTP::API::Master::V3::Environments do
         | 
| 8 8 | 
             
              include JSONMatchers
         | 
| 9 9 |  | 
| 10 | 
            -
               | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 10 | 
            +
              let(:environment) { Puppet::Node::Environment.create(:production, ["/first", "/second"], '/manifests') }
         | 
| 11 | 
            +
              let(:loader) { Puppet::Environments::Static.new(environment) }
         | 
| 12 | 
            +
              let(:handler) { Puppet::Network::HTTP::API::Master::V3::Environments.new(loader) }
         | 
| 13 | 
            +
              let(:request) { Puppet::Network::HTTP::Request.from_hash(:headers => { 'accept' => 'application/json' }) }
         | 
| 14 | 
            +
              let(:response) { Puppet::Network::HTTP::MemoryResponse.new }
         | 
| 15 15 |  | 
| 16 | 
            -
             | 
| 16 | 
            +
              it "responds with all of the available environments" do
         | 
| 17 | 
            +
                handler.call(request, response)
         | 
| 17 18 |  | 
| 18 19 | 
             
                expect(response.code).to eq(200)
         | 
| 19 20 | 
             
                expect(response.type).to eq("application/json")
         | 
| @@ -33,29 +34,17 @@ describe Puppet::Network::HTTP::API::Master::V3::Environments do | |
| 33 34 | 
             
              end
         | 
| 34 35 |  | 
| 35 36 | 
             
              it "the response conforms to the environments schema for unlimited timeout" do
         | 
| 36 | 
            -
                 | 
| 37 | 
            -
                expect(conf_stub).to receive(:environment_timeout).and_return(Float::INFINITY)
         | 
| 38 | 
            -
                environment = Puppet::Node::Environment.create(:production, [])
         | 
| 39 | 
            -
                env_loader = Puppet::Environments::Static.new(environment)
         | 
| 40 | 
            -
                expect(env_loader).to receive(:get_conf).with(:production).and_return(conf_stub)
         | 
| 41 | 
            -
                handler = Puppet::Network::HTTP::API::Master::V3::Environments.new(env_loader)
         | 
| 42 | 
            -
                response = Puppet::Network::HTTP::MemoryResponse.new
         | 
| 37 | 
            +
                Puppet[:environment_timeout] = 'unlimited'
         | 
| 43 38 |  | 
| 44 | 
            -
                handler.call( | 
| 39 | 
            +
                handler.call(request, response)
         | 
| 45 40 |  | 
| 46 41 | 
             
                expect(response.body).to validate_against('api/schemas/environments.json')
         | 
| 47 42 | 
             
              end
         | 
| 48 43 |  | 
| 49 44 | 
             
              it "the response conforms to the environments schema for integer timeout" do
         | 
| 50 | 
            -
                 | 
| 51 | 
            -
             | 
| 52 | 
            -
                 | 
| 53 | 
            -
                env_loader = Puppet::Environments::Static.new(environment)
         | 
| 54 | 
            -
                expect(env_loader).to receive(:get_conf).with(:production).and_return(conf_stub)
         | 
| 55 | 
            -
                handler = Puppet::Network::HTTP::API::Master::V3::Environments.new(env_loader)
         | 
| 56 | 
            -
                response = Puppet::Network::HTTP::MemoryResponse.new
         | 
| 57 | 
            -
             | 
| 58 | 
            -
                handler.call(Puppet::Network::HTTP::Request.from_hash(:headers => { 'accept' => 'application/json' }), response)
         | 
| 45 | 
            +
                Puppet[:environment_timeout] = 1
         | 
| 46 | 
            +
             | 
| 47 | 
            +
                handler.call(request, response)
         | 
| 59 48 |  | 
| 60 49 | 
             
                expect(response.body).to validate_against('api/schemas/environments.json')
         | 
| 61 50 | 
             
              end
         | 
| @@ -49,9 +49,10 @@ describe Puppet::Provider::Exec do | |
| 49 49 | 
             
                    # we can't reference that in our manifest. Windows PATHs can contain
         | 
| 50 50 | 
             
                    # double quotes and trailing backslashes, which confuse HEREDOC
         | 
| 51 51 | 
             
                    # interpolation below. So sanitize it:
         | 
| 52 | 
            -
                    ENV['PATH'].split(File::PATH_SEPARATOR) | 
| 53 | 
            -
             | 
| 54 | 
            -
             | 
| 52 | 
            +
                    ENV['PATH'].split(File::PATH_SEPARATOR)
         | 
| 53 | 
            +
                               .map { |dir| dir.gsub(/"/, '\"').gsub(/\\$/, '') }
         | 
| 54 | 
            +
                               .map { |dir| Pathname.new(dir).cleanpath.to_s }
         | 
| 55 | 
            +
                               .join(File::PATH_SEPARATOR)
         | 
| 55 56 | 
             
                  else
         | 
| 56 57 | 
             
                    ENV['PATH']
         | 
| 57 58 | 
             
                  end
         | 
| @@ -32,7 +32,7 @@ describe Puppet::Type.type(:package).provider(:dpkg), unless: Puppet::Util::Plat | |
| 32 32 | 
             
                  expect(Puppet::Util::Execution).to receive(:execpipe).with(execpipe_args).and_yield(bash_installed_io)
         | 
| 33 33 |  | 
| 34 34 | 
             
                  installed = double('bash')
         | 
| 35 | 
            -
                  expect(described_class).to receive(:new).with(:ensure => "4.2-5ubuntu3", :error => "ok", :desired => "install", :name => "bash", :status => "installed", :provider => :dpkg).and_return(installed)
         | 
| 35 | 
            +
                  expect(described_class).to receive(:new).with(:ensure => "4.2-5ubuntu3", :error => "ok", :desired => "install", :name => "bash", :mark => :none, :status => "installed", :provider => :dpkg).and_return(installed)
         | 
| 36 36 |  | 
| 37 37 | 
             
                  expect(described_class.instances).to eq([installed])
         | 
| 38 38 | 
             
                end
         | 
| @@ -41,9 +41,9 @@ describe Puppet::Type.type(:package).provider(:dpkg), unless: Puppet::Util::Plat | |
| 41 41 | 
             
                  expect(Puppet::Util::Execution).to receive(:execpipe).with(execpipe_args).and_yield(all_installed_io)
         | 
| 42 42 |  | 
| 43 43 | 
             
                  bash = double('bash')
         | 
| 44 | 
            -
                  expect(described_class).to receive(:new).with(:ensure => "4.2-5ubuntu3", :error => "ok", :desired => "install", :name => "bash", :status => "installed", :provider => :dpkg).and_return(bash)
         | 
| 44 | 
            +
                  expect(described_class).to receive(:new).with(:ensure => "4.2-5ubuntu3", :error => "ok", :desired => "install", :name => "bash", :mark => :none, :status => "installed", :provider => :dpkg).and_return(bash)
         | 
| 45 45 | 
             
                  vim = double('vim')
         | 
| 46 | 
            -
                  expect(described_class).to receive(:new).with(:ensure => "2:7.3.547-6ubuntu5", :error => "ok", :desired => "install", :name => "vim", :status => "installed", :provider => :dpkg).and_return(vim)
         | 
| 46 | 
            +
                  expect(described_class).to receive(:new).with(:ensure => "2:7.3.547-6ubuntu5", :error => "ok", :desired => "install", :name => "vim", :mark => :none, :status => "installed", :provider => :dpkg).and_return(vim)
         | 
| 47 47 |  | 
| 48 48 | 
             
                  expect(described_class.instances).to eq([bash, vim])
         | 
| 49 49 | 
             
                end
         | 
| @@ -107,7 +107,7 @@ describe Puppet::Type.type(:package).provider(:dpkg), unless: Puppet::Util::Plat | |
| 107 107 | 
             
                    it "returns a hash of the found package status for an installed package" do
         | 
| 108 108 | 
             
                      dpkg_query_execution_with_multiple_args_returns(query_output, args_with_provides,virtual_packages_query_args)
         | 
| 109 109 | 
             
                      dpkg_query_execution_with_multiple_args_returns(dpkg_query_result, args, query_args)
         | 
| 110 | 
            -
                      expect(provider.query).to eq(:ensure => "2.7.13", :error => "ok", :desired => "install", :name => "python", :status => "installed", :provider => :dpkg)
         | 
| 110 | 
            +
                      expect(provider.query).to eq(:ensure => "2.7.13", :error => "ok", :desired => "install", :name => "python", :mark => :none, :status => "installed", :provider => :dpkg)
         | 
| 111 111 | 
             
                    end
         | 
| 112 112 |  | 
| 113 113 | 
             
                    it "considers the package absent if the dpkg-query result cannot be interpreted" do
         | 
| @@ -160,6 +160,20 @@ describe Puppet::Type.type(:package).provider(:dpkg), unless: Puppet::Util::Plat | |
| 160 160 | 
             
                      expect(provider.query[:mark]).to eq(:hold)
         | 
| 161 161 | 
             
                    end
         | 
| 162 162 |  | 
| 163 | 
            +
                    it "considers the package held if its state is 'hold'" do
         | 
| 164 | 
            +
                      dpkg_query_execution_with_multiple_args_returns(query_output.gsub("install","hold"),args_with_provides,virtual_packages_query_args)
         | 
| 165 | 
            +
                      dpkg_query_execution_with_multiple_args_returns(dpkg_query_result.gsub("install","hold"), args, query_args)
         | 
| 166 | 
            +
                      expect(provider.query[:ensure]).to eq("2.7.13")
         | 
| 167 | 
            +
                      expect(provider.query[:mark]).to eq(:hold)
         | 
| 168 | 
            +
                    end
         | 
| 169 | 
            +
             | 
| 170 | 
            +
                    it "considers mark status to be none if package is not held" do
         | 
| 171 | 
            +
                      dpkg_query_execution_with_multiple_args_returns(query_output.gsub("install","ok"),args_with_provides,virtual_packages_query_args)
         | 
| 172 | 
            +
                      dpkg_query_execution_with_multiple_args_returns(dpkg_query_result.gsub("install","ok"), args, query_args)
         | 
| 173 | 
            +
                      expect(provider.query[:ensure]).to eq("2.7.13")
         | 
| 174 | 
            +
                      expect(provider.query[:mark]).to eq(:none)
         | 
| 175 | 
            +
                    end
         | 
| 176 | 
            +
             | 
| 163 177 | 
             
                    context "regex check for query search" do
         | 
| 164 178 | 
             
                      let(:resource_name) { 'python-email' }
         | 
| 165 179 | 
             
                      let(:resource) { instance_double('Puppet::Type::Package') }
         | 
| @@ -168,10 +182,10 @@ describe Puppet::Type.type(:package).provider(:dpkg), unless: Puppet::Util::Plat | |
| 168 182 | 
             
                        allow(resource).to receive(:[]=)
         | 
| 169 183 | 
             
                      end
         | 
| 170 184 |  | 
| 171 | 
            -
                      it "checks if virtual package regex for query is  | 
| 185 | 
            +
                      it "checks if virtual package regex for query is correct and physical package is installed" do
         | 
| 172 186 | 
             
                        dpkg_query_execution_with_multiple_args_returns(query_output,args_with_provides,virtual_packages_query_args)
         | 
| 173 187 | 
             
                        dpkg_query_execution_with_multiple_args_returns(dpkg_query_result, args, query_args)
         | 
| 174 | 
            -
                        expect(provider.query).to match({:desired=>"install", :ensure=>"2.7.13", :error=>"ok", :name=>"python", :provider | 
| 188 | 
            +
                        expect(provider.query).to match({:desired => "install", :ensure => "2.7.13", :error => "ok", :name => "python", :mark => :none, :provider => :dpkg, :status => "installed"})
         | 
| 175 189 | 
             
                      end
         | 
| 176 190 |  | 
| 177 191 | 
             
                      context "regex check with no partial matching" do
         | 
| @@ -208,7 +222,7 @@ describe Puppet::Type.type(:package).provider(:dpkg), unless: Puppet::Util::Plat | |
| 208 222 | 
             
                  it "returns a hash of the found package status for an installed package" do
         | 
| 209 223 | 
             
                    dpkg_query_execution_returns(bash_installed_output)
         | 
| 210 224 |  | 
| 211 | 
            -
                    expect(provider.query).to eq({:ensure => "4.2-5ubuntu3", :error => "ok", :desired => "install", :name => "bash", :status => "installed", :provider => :dpkg})
         | 
| 225 | 
            +
                    expect(provider.query).to eq({:ensure => "4.2-5ubuntu3", :error => "ok", :desired => "install", :name => "bash", :mark => :none, :status => "installed", :provider => :dpkg})
         | 
| 212 226 | 
             
                  end
         | 
| 213 227 |  | 
| 214 228 | 
             
                  it "considers the package absent if the dpkg-query result cannot be interpreted" do
         | 
| @@ -271,6 +285,7 @@ describe Puppet::Type.type(:package).provider(:dpkg), unless: Puppet::Util::Plat | |
| 271 285 | 
             
                        :error => 'ok',
         | 
| 272 286 | 
             
                        :status => 'status',
         | 
| 273 287 | 
             
                        :name => resource_name,
         | 
| 288 | 
            +
                        :mark => :none,
         | 
| 274 289 | 
             
                        :ensure => 'ensure',
         | 
| 275 290 | 
             
                        :provider => :dpkg,
         | 
| 276 291 | 
             
                      }
         | 
| @@ -46,6 +46,8 @@ describe Puppet::Type.type(:package).provider(:openbsd) do | |
| 46 46 | 
             
                allow(described_class).to receive(:command).with(:pkginfo).and_return('/bin/pkg_info')
         | 
| 47 47 | 
             
                allow(described_class).to receive(:command).with(:pkgadd).and_return('/bin/pkg_add')
         | 
| 48 48 | 
             
                allow(described_class).to receive(:command).with(:pkgdelete).and_return('/bin/pkg_delete')
         | 
| 49 | 
            +
             | 
| 50 | 
            +
                allow(Puppet::FileSystem).to receive(:exist?)
         | 
| 49 51 | 
             
              end
         | 
| 50 52 |  | 
| 51 53 | 
             
              context "#instances" do
         | 
| @@ -0,0 +1,36 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            describe Puppet::Type.type(:package).provider(:pip2) do
         | 
| 4 | 
            +
             | 
| 5 | 
            +
              it { is_expected.to be_installable }
         | 
| 6 | 
            +
              it { is_expected.to be_uninstallable }
         | 
| 7 | 
            +
              it { is_expected.to be_upgradeable }
         | 
| 8 | 
            +
              it { is_expected.to be_versionable }
         | 
| 9 | 
            +
              it { is_expected.to be_install_options }
         | 
| 10 | 
            +
              it { is_expected.to be_targetable }
         | 
| 11 | 
            +
             | 
| 12 | 
            +
              it "should inherit most things from pip provider" do
         | 
| 13 | 
            +
                expect(described_class < Puppet::Type.type(:package).provider(:pip))
         | 
| 14 | 
            +
              end
         | 
| 15 | 
            +
             | 
| 16 | 
            +
              it "should use pip2 command" do
         | 
| 17 | 
            +
                expect(described_class.cmd).to eq(["pip2"])
         | 
| 18 | 
            +
              end
         | 
| 19 | 
            +
             | 
| 20 | 
            +
              context 'calculated specificity' do
         | 
| 21 | 
            +
                context 'when is not defaultfor' do
         | 
| 22 | 
            +
                  subject { described_class.specificity }
         | 
| 23 | 
            +
                  it { is_expected.to eql 1 }
         | 
| 24 | 
            +
                end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                context 'when is defaultfor' do
         | 
| 27 | 
            +
                  let(:os) {  Facter.value(:operatingsystem) }
         | 
| 28 | 
            +
                  subject do
         | 
| 29 | 
            +
                    described_class.defaultfor(operatingsystem: os)
         | 
| 30 | 
            +
                    described_class.specificity
         | 
| 31 | 
            +
                  end
         | 
| 32 | 
            +
                  it { is_expected.to be > 100 }
         | 
| 33 | 
            +
                end
         | 
| 34 | 
            +
              end
         | 
| 35 | 
            +
             | 
| 36 | 
            +
            end
         |