Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-11375

Cannot ensure user absent and purge its ssh keys in same manifest

    XMLWordPrintable

Details

    • Bug
    • Status: Accepted
    • Normal
    • Resolution: Unresolved
    • None
    • None
    • None
    • None
    • Needs Assessment
    • Needs Assessment

    Description

      How to reproduce:

      ➜ cat create_user.pp
      user {'luchi':
        ensure => present,
        managehome => true,
        purge_ssh_keys => true
      }
      ➜ cat add_ssh_key.pp
      ssh_authorized_key { 'luchi@example.com':
        ensure => present,
        user   => 'luchi',
        type   => 'ssh-rsa',
        key    => 'my-key'
      }
      ➜ cat remove_user.pp
      user {'luchi':
        ensure => absent,
        purge_ssh_keys => true
      }
      ➜ puppet apply create_user.pp
      ...
      ➜ puppet apply add_ssh_key.pp
      ...
      ➜ puppet apply remove_user.pp --debug --trace
      ...
      Debug: User[luchi] parsed for purging Ssh_authorized_key[luchi@example.com]
      Debug: /Stage[main]/Main/User[luchi]: Nothing to manage: no ensure and the resource doesn't exist
      Debug: Prefetching parsed resources for ssh_authorized_key
      Notice: /Stage[main]/Main/Ssh_authorized_key[luchi@example.com]/ensure: removed
      Error: /Stage[main]/Main/Ssh_authorized_key[luchi@example.com]: Could not evaluate: User 'luchi' does not exist
      /etc/puppetlabs/code/modules/sshkeys_core/lib/puppet/provider/ssh_authorized_key/parsed.rb:71:in `flush'
      /root/puppet/lib/puppet/type.rb:1022:in `flush'
      /root/puppet/lib/puppet/transaction/resource_harness.rb:25:in `evaluate'
      /root/puppet/lib/puppet/transaction.rb:267:in `apply'
      /root/puppet/lib/puppet/transaction.rb:287:in `eval_resource'
      ...
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              luchian.nemes Luchian Nemes
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Zendesk Support