voxpupuli / puppet-lint-strict_indent-check

indent check for puppet-lint
Mozilla Public License 2.0
4 stars 11 forks source link

strict_indent fires a warning about the indent of a heredoc #26

Closed jay7x closed 2 years ago

jay7x commented 2 years ago

I see some strange behaviour of strict_indent when linting my Bolt plans.

pdk bundle exec puppet-lint plans/fix_bond0.pp
...
WARNING: indent should be 8 chars and is 0 on line 23 (check: strict_indent)

Line 23 is 1st line of an indented heredoc (https://puppet.com/docs/puppet/7/lang_data_string.html#lang_data_string_heredocs-stripindent)

        [Match]

I tried to change indentation of the heredoc but it didn't help.. message is still the same.

Plan is below (slightly redacted):

plan example::fix_bond0(
  TargetSpec $targets,
  String $run_as = 'root',
  Boolean $noop = true,
) {
  apply_prep($targets, { _run_as => $run_as })

  $res = apply($targets, {
      _run_as       => $run_as,
      _noop         => $noop,
      _catch_errors => true,
  }) {
    $bond0 = $facts['networking']['interfaces']['bond0']

    file { '/etc/systemd/network/bond0.network':
      ensure    => 'file',
      backup    => '.bak',
      owner     => 'root',
      group     => 'root',
      mode      => '0644',
      show_diff => true,
      content   => @("EOD"),
        [Match]
        Name=bond0

        [Link]
        MTUBytes=${bond0['mtu']}
        MACAddress=${bond0['mac'].upcase}
        ActivationPolicy=always-up

        [Network]
        VLAN=public
        VLAN=private
        | EOD
    }
    ~> exec { 'networkctl_reload':
      command     => '/usr/bin/networkctl reload',
      refreshonly => true,
    }
  }
}
alexjfisher commented 2 years ago

Duplicate of https://github.com/voxpupuli/puppet-lint-strict_indent-check/issues/20