diff --git a/lib/puppet/face/config.rb b/lib/puppet/face/config.rb index a79fba90ad..c2c7f9d1a1 100644 --- a/lib/puppet/face/config.rb +++ b/lib/puppet/face/config.rb @@ -171,6 +171,7 @@ def report_section_and_environment(section_name, environment_name) end path = Puppet::FileSystem.pathname(Puppet.settings.which_configuration_file) + Puppet::FileSystem.dir_mkpath(path) Puppet::FileSystem.touch(path) Puppet::FileSystem.open(path, nil, 'r+:UTF-8') do |file| Puppet::Settings::IniFile.update(file) do |config| diff --git a/spec/unit/face/config_spec.rb b/spec/unit/face/config_spec.rb index 052cd5c3a2..f5ad216b36 100644 --- a/spec/unit/face/config_spec.rb +++ b/spec/unit/face/config_spec.rb @@ -131,6 +131,7 @@ def render(action, result) before(:each) do Puppet[:config] = config_file allow(Puppet::FileSystem).to receive(:pathname).with(path.to_s).and_return(path) + allow(Puppet::FileSystem).to receive(:dir_mkpath) allow(Puppet::FileSystem).to receive(:touch) end