Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support rich datatypes and deferred password values #515

Merged
merged 1 commit into from
Apr 26, 2024

Conversation

traylenator
Copy link
Contributor

@traylenator traylenator commented Apr 16, 2024

Pull Request (PR) description

Process the configuration file redis.conf template twice if some of the templates values are deferred.

Currently with deferred values the resulting deferred template cannot be processed since it contains
complex datatypes from stdlib in particular.

This is a redis specific solution that may arrive generally one day in puppetlabs/puppetlabs-stdlib#1425

This Pull Request (PR) fixes the following issues

Fixes #513

@traylenator traylenator added the bug Something isn't working label Apr 16, 2024
manifests/instance.pp Outdated Show resolved Hide resolved
manifests/instance.pp Outdated Show resolved Hide resolved
Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to have some sort of test for this. Looking at the rspec-puppet source it should support Deferred.

And taking a step back, this feels like Sensitive where EPP itself should take care of it.

@traylenator
Copy link
Contributor Author

Tests fail for unrelated reason - resolved in #516

@traylenator
Copy link
Contributor Author

It would be nice to have some sort of test for this. Looking at the rspec-puppet source it should support Deferred.

Could not see anyway to do something along the lines of:

describe 'with parameter requirepass resolved from a Deferred' do
  let(:params) do
    {
      requirepass: Deferred('sprintf',['%s', '_VALUE_']),
    }
  end

  it {
    is_expected.to contain_file(config_file_orig).with(
      'content' => sensitive(%r{requirepass.*_VALUE_})
    )
  }
end

And taking a step back, this feels like Sensitive where EPP itself should take care of it.

Not sure I follow. We already test that if requirepass is Sensitive that the content of resulting config file is also marked Sensitive.

@ekohl
Copy link
Member

ekohl commented Apr 23, 2024

Not sure I follow. We already test that if requirepass is Sensitive that the content of resulting config file is also marked Sensitive.

I was suggesting that Puppet itself should take care of this, just like it can unwrap sensitive. Pushing that responsibility to modules is likely to cause problem somewhere.

Of course it doesn't hold this PR back, maybe more ranting.

Process the configuration file `redis.conf` template twice if
some of the templates values are deferred.

Currently with deferred values the resulting deferred
template cannot be processed since it contains
complex datatypes from stdlib in particular.

This is a redis specific solution that may arrive genraly one
day in puppetlabs/puppetlabs-stdlib#1425
@traylenator
Copy link
Contributor Author

CentOS 9 is a timeout.

@traylenator traylenator merged commit 584e231 into voxpupuli:master Apr 26, 2024
21 of 22 checks passed
@traylenator traylenator deleted the deferredcomplex branch April 26, 2024 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use of deferred function fails due to complex types in epp
2 participants