aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorGabriel Nagy <gabriel.nagy@puppet.com>2021-02-22 19:00:25 +0200
committerGabriel Nagy <gabriel.nagy@puppet.com>2021-02-22 19:08:35 +0200
commit44be62fc43407528d5873cdee1559c55a373257b (patch)
tree010e0198e5fa38a6f888b45cb842d879094ada3d /spec
parent209b03b13f67a76e53048c5f854af7d0bd0a6a87 (diff)
downloadpuppet-augeas_core-44be62fc43407528d5873cdee1559c55a373257b.tar.gz
puppet-augeas_core-44be62fc43407528d5873cdee1559c55a373257b.tar.bz2
(MODULES-10950) Infer application name from run mode
Fix a regression introduced by MODULES-7397[1] which incorrectly assumed that the application name can be queried through `Puppet::Application.name`, causing lenses that are pluginsynced not to be loaded. Since we only need to find out whether or not we're running as part of `puppet agent`, it should be enough to use `Puppet.run_mode.name`, which returns `:agent` in this case, and `:user` otherwise. [1] https://github.com/puppetlabs/puppetlabs-augeas_core/pull/27
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/provider/augeas/augeas_spec.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/spec/unit/provider/augeas/augeas_spec.rb b/spec/unit/provider/augeas/augeas_spec.rb
index 2d53933..f98a0f4 100644
--- a/spec/unit/provider/augeas/augeas_spec.rb
+++ b/spec/unit/provider/augeas/augeas_spec.rb
@@ -1124,7 +1124,7 @@ describe Puppet::Type.type(:augeas).provider(:augeas) do
context 'when running application is agent' do
before(:each) do
Puppet[:libdir] = my_fixture_dir
- Puppet::Application.stubs(:name).returns(:agent)
+ Puppet.run_mode.stubs(:name).returns(:agent)
end
it 'offers pluginsync augeas/lenses subdir' do
@@ -1139,7 +1139,7 @@ describe Puppet::Type.type(:augeas).provider(:augeas) do
context 'when running application is not agent' do
before(:each) do
- Puppet::Application.stubs(:name).returns(:apply)
+ Puppet.run_mode.stubs(:name).returns(:user)
env = Puppet::Node::Environment.create('root', ['/modules/foobar'])
Puppet.stubs(:lookup).returns(env)