Skip to content

linter incorrectly detecting command statement #41

Open
@maxadamo

Description

@maxadamo

Describe the Bug

I have a cron resource, and the linter is detecting the parameter minute as a command statement, and it's reporting an unsafe interpolation.

Expected Behavior

Detect proper statements within the resource, and throw warning whereas necessary.

Steps to Reproduce

I have the following code:

  cron {
    default:
      user        => 'root',
      hour        => '*',
      month       => '*',
      monthday    => '*',
      weekday     => '*',
      environment => 'STARTED_BY_CRON=yes';
    # ensure that the VXLANs are up and running (ideally this should be done by systemd)
    'keep-vxlan-up':
      ensure  => $cron_ensure_status,
      command => 'flock /tmp/vxlan-configurator /usr/local/bin/vxlan-configurator.sh --status up --name all',
      minute  => "*/${$keep_vxlan_up_cron_interval}";
    # it unconfigures the VXLANs that are not in use and disable corresponding systemd services
    # it's also triggered when the directory /etc/vxlan/{multicast,unicast}.d is changed
    'purge_unused_vxlans':
      ensure  => present,
      command => 'flock /tmp/vxlan-configurator /usr/local/bin/vxlan-configurator.sh --purge',
      minute  => fqdn_rand(59);
  }

and the linter is throwing the following error:

./manifests/config.pp - WARNING: unsafe interpolation of variable 'keep_vxlan_up_cron_interval' in exec command on line 118 (check: check_unsafe_interpolations)

Environment

  • Linter plugin version: 0.0.4
  • Puppet Version: 7.xx
  • Platform Ubuntu 20.04

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions