https://www.puppet.com/community logo
Join Slack
Powered by
# voxpupuli
  • b

    bastelfreak

    04/20/2022, 5:57 PM
    there was probably a good explanation in the PR where I added it to voxpupuli-puppet-lint-plugins
  • k

    Keith Ward

    04/20/2022, 5:59 PM
    Add puppet-lint-top_scope_facts-check
    Copy code
    I did some tests on our modules and didn't notice any false positives.
    <https://github.com/mmckinst> maintains two plugins. We already use their
    awesome puppet-lint-legacy_facts-check plugin.
    puppet-lint-top_scope_facts-check is a good addition to it. This points
    out facts being accessed via top scope like `${::kernel}`. Most of the
    occurrences can also be autofixed.
  • b

    bastelfreak

    04/20/2022, 5:59 PM
    https://github.com/voxpupuli/voxpupuli-puppet-lint-plugins/pull/5 mhm
  • b

    bastelfreak

    04/20/2022, 5:59 PM
    https://github.com/voxpupuli/voxpupuli-puppet-lint-plugins/pull/5 mhm
  • k

    Keith Ward

    04/20/2022, 5:59 PM
    yep
  • k

    Keith Ward

    04/20/2022, 6:06 PM
    and indeed if i switch off topscope facts, and do
    "${::kernel} foo"
    it doesn't highlight it as a problem
  • k

    Keith Ward

    04/20/2022, 6:21 PM
    I've raised the issue with top_scope_facts-check in https://github.com/mmckinst/puppet-lint-top_scope_facts-check/issues/10
  • k

    Keith Ward

    04/20/2022, 6:21 PM
    I've raised the issue with top_scope_facts-check in https://github.com/mmckinst/puppet-lint-top_scope_facts-check/issues/10
  • k

    Keith Ward

    04/20/2022, 6:22 PM
    Copy code
    WARNING: top scope fact instead of facts hash on line 6 (check: top_scope_facts)
    WARNING: use $mymodule::foo::var instead of $::mymodule::foo::var on line 6 (check: topscope_variable)
    Incidentally now when i run it I'm getting both outputs ^
  • k

    Keith Ward

    04/20/2022, 6:22 PM
    whereas i'm sure I only got top_scope_facts earlier
  • k

    Keith Ward

    04/20/2022, 6:22 PM
    whereas i'm sure only got top_scope_facts earlier
  • k

    Keith Ward

    04/20/2022, 6:22 PM
    whereas i'm sure I only got top_scope_facts earlier
  • b

    bastelfreak

    04/20/2022, 6:33 PM
    I think the implementation of puppet-lint-legacy_facts-check and puppet-lint-top_scope_facts-check should be checked. maybe they can be combined/one check is obsolete
  • k

    Keith Ward

    04/20/2022, 6:41 PM
    aye possibly
  • v

    VoxBot

    04/20/2022, 7:19 PM
    o/ This is a call for testers: I just released a gem named 'yaml-sort' with the purpose of sorting YAML data e.g. in Hiera files. If you are the kind of person who likes to see things in a predictable order, you may want to give it a try :-D
  • v

    VoxBot

    04/20/2022, 7:20 PM
    I tested this against my control-repo hiera data and some Rails i18n translations with great success, but I am sure edge cases will be found. The code is here: https://github.com/smortex/yaml-sort
  • v

    VoxBot

    04/20/2022, 7:28 PM
    smortex: o/
  • v

    VoxBot

    04/20/2022, 7:29 PM
    bastelfreak: o/
  • v

    VoxBot

    04/20/2022, 7:29 PM
    ah, thats nice for my control repo
  • v

    VoxBot

    04/20/2022, 7:30 PM
    would also be nice for our data in modules
  • v

    VoxBot

    04/20/2022, 7:33 PM
    Hehe, might :-) I tries hard to keep the style of what is in the YAML file (e.g. quotted strings and unquoted ones, spacing before list items, comments) that you can't do with just parsing and saving
  • v

    VoxBot

    04/20/2022, 7:33 PM
    I will be happy to have the results of your tests in your control repo
  • v

    VoxBot

    04/20/2022, 7:35 PM
    I guess some contol-comments will be required for lists that should not be sorted, not hit it directly but I saw some ordering change in aliases of webservers which trigger some resources in puppet
  • v

    VoxBot

    04/20/2022, 7:35 PM
    I can imagine situations where an array must not be touched ;-)
  • v

    VoxBot

    04/20/2022, 7:40 PM
    details, details :D
  • v

    VoxBot

    04/20/2022, 7:44 PM
    "example.com www.example.com example.net www.example.net" became "example.com example.net www.example.com www.example.net" in dehydrated config so it was triggered to refresh the certificate. Likewise for the aliases of the domain in the webserver config file.
  • v

    VoxBot

    04/20/2022, 7:44 PM
    Really harmless in this case, affected only 2 nodes out of a few dozens
  • v

    VoxBot

    04/20/2022, 7:45 PM
    an option to only sort the yaml keys and not their values would be nice
  • v

    VoxBot

    04/20/2022, 7:47 PM
    yeah, maybe a flag to opt-out of sorting lists / dictionaries on demand
  • v

    VoxBot

    04/20/2022, 7:47 PM
    That's the reason for my CFT, gather other people feedback!
12345...640Latest