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

nested ensure misdetected as not coming first. #410

Closed
jamesooden opened this issue Mar 26, 2015 · 13 comments · Fixed by #877
Closed

nested ensure misdetected as not coming first. #410

jamesooden opened this issue Mar 26, 2015 · 13 comments · Fixed by #877
Milestone

Comments

@jamesooden
Copy link

Taking the following puppet code:

class thing {
    class {'thang':
        stuff => {
            'stuffing' => {
                ensure => 'present',
                blah   => 'bleah',
            }
        },
    }
}

And running puppet-lint against it I will get the following warning:

WARNING: ensure found on line but it's not the first attribute on line 6

Which is not true, as the ensure is embedded in the next level of the structure and at that level it is the first attribute.

@ghoneycutt
Copy link
Contributor

ensure is not an attribute at all in this case as it is on the right side of the attribute assignment.

@jamesooden
Copy link
Author

Right, and should not cause the warning to be flagged.

@benohara
Copy link

benohara commented Jul 9, 2015

We see this for stuff relating to the mysql module, users, grants etc :(

@jeff1evesque
Copy link

I may look for alternative linters, as I find this a necessity. Otherwise, my travis will give me a nice red button on my README.md stating that puppet-lint is unable to detect ensure properly.

@ghoneycutt
Copy link
Contributor

@jeff1evesque
Copy link

@ghoneycutt, thank you! I will most likely consider the following disabling check syntax:

  • puppet-lint --no-ensure_first_param-check path/to/file.pp

@rnelson0
Copy link
Collaborator

@jamesooden @benohara Can either of you link to a use of this in practical code? The example code does not make sense, as ensure should be a quoted word where it's being used as a hash key.

@jamesooden
Copy link
Author

Not anymore; I don't work for that company any more. I assure you it was
in practical code. Sorry the example doesn't make sense to you...James

On Sat, Jun 25, 2016 at 12:38 AM, Rob Nelson [email protected]
wrote:

@jamesooden https://github.com/jamesooden @benohara
https://github.com/benohara Can either of you link to a use of this in
practical code? The example code does not make sense, as ensure should be
a quoted word where it's being used as a hash key.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#410 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AJQNzMJOyEVLg2u8fnywd8qDPr4iWVG9ks5qPLDhgaJpZM4D1NZ3
.

@rnelson0
Copy link
Collaborator

@jamesooden I wasn't seeing the context properly, but I see it now. Working on a PR.

@rnelson0
Copy link
Collaborator

rnelson0 commented Jul 2, 2016

Fixed in #490. Thanks!

@rnelson0 rnelson0 closed this as completed Jul 2, 2016
@Fabian1976
Copy link

Is this allready in a release? Because with the most recent version of lint (2.3.6), I still get this error:

manifests/profile/citrix/vda.pp - WARNING: ensure found on line but it's not the first attribute on line 47

This is the piece of code:

  dsc { 'xWindowsFeature_RDS-RD-Server':
    notify                  => Reboot['After_Features'],
    dsc_resource_name       => 'xWindowsFeature',
    dsc_resource_module     => 'xPSDesiredStateConfiguration',
    dsc_resource_properties => {
      ensure               => 'present',
      name                 => 'RDS-RD-Server',
      psdscrunascredential => {
        dsc_type       => 'MSFT_Credential',
        dsc_properties => $admin,
      },
    },
  }

@rodjek
Copy link
Owner

rodjek commented Jul 30, 2018

Confirmed that this seems to have regressed.

@rodjek rodjek reopened this Jul 30, 2018
@rodjek rodjek added this to the 2.4.0 milestone Sep 27, 2019
rodjek added a commit that referenced this issue Sep 28, 2019
Ignore hash keys when checking resource parameter order
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

Successfully merging a pull request may close this issue.

7 participants