Skip to content

Purging sensu bonsai assets deletes all assets #1321

@elfranne

Description

@elfranne

Asset resources are created with a suffix in default, this cause purge to delete all assets:

When adding assets, for example:

  $bonsai_assets = [
    'sensu-plugins/sensu-plugins-process-checks',
    'sensu-plugins/sensu-plugins-puppet',
    'sensu-plugins/sensu-plugins-ssl',
    'sensu-plugins/sensu-plugins-systemd',
    'sensu-plugins/sensu-plugins-uptime-checks',
    'sensu/http-checks',
  ]
  sensu_bonsai_asset { $bonsai_assets:
    ensure  => present,
    version => latest,
  }

Puppet creates the assets:

[...]
Notice: /Stage[main]/Profile::Sensu::Backend/Sensu_bonsai_asset[sensu-plugins/sensu-plugins-puppet]/ensure: created (corrective)
[...]

and check the ressource:

puppet resource Sensu_bonsai_asset
[...]
sensu_bonsai_asset { 'sensu-plugins/sensu-plugins-puppet in default':
  ensure   => 'present',
  provider => 'sensuctl',
  version  => '3.0.0',
}
[...]

But if we went to ensure all the assets are managed and add:

  sensu_resources { 'sensu_bonsai_asset':
    purge => true,
  }

We then see that all assets are removed:

[...]
Notice: /Stage[main]/Profile::Sensu::Backend/Sensu_bonsai_asset[sensu/sensu-plugins-puppet in default]/ensure: removed
[...]

Ubuntu 20.04
Default Ruby from the repo: 2.7.4p191
puppet agent: 7.15.0
sensu puppet module: 5.8.0 (latest)
sensu-backend: 6.4.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions