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

node_params key => :undef not passed properly to puppet #707

Open
MorningLightMountain713 opened this issue Jul 3, 2018 · 0 comments
Open

Comments

@MorningLightMountain713
Copy link

MorningLightMountain713 commented Jul 3, 2018

I have the following excerpt from a spec:

context "with no default algorithm set" do
  let(:node_params) do
    super().merge(
      'foo::default_algorithm' => :undef,
    )
  end
  it { is_expected.to 
    compile.and_raise_error(%r{.*default algorithm must be set.*}) }
end

and the following in a puppet class:

class foo::bar {
  $default_algorithm = $foo::default_algorithm
  if (!$default_algorithm) {
    fail("default algorithm must be set")
  }
}

I would expect that the test should pass however the catalogue compiles instead of raising an error as the :undef symbol is seen as the string 'undef' so the if statement evaluates to true.

The way around this is to change my puppet code to be:

if ($default_algorithm == undef or $default_algorithm == 'undef') {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant