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

    jhoblitt

    06/17/2022, 9:12 PM
    because the file type is crazy
  • j

    jhoblitt

    06/17/2022, 9:20 PM
    I can't even figure out where :replace is used
  • t

    tvaughan

    06/17/2022, 9:25 PM
    type/file/target.rb
    👍 1
  • j

    jhoblitt

    06/17/2022, 9:27 PM
    I didn't search for
    relace?
    . duh.
  • n

    natemccurdy

    06/17/2022, 9:27 PM
    Setting
    ensure => link
    calls the
    mklink
    method. • https://github.com/puppetlabs/puppet/blob/7.17.0/lib/puppet/type/file/ensure.rb#L104
    mklink
    then just replaces the link and doesn’t look for
    replace
    at all: • https://github.com/puppetlabs/puppet/blob/7.17.0/lib/puppet/type/file/target.rb#L34-L61
  • n

    natemccurdy

    06/17/2022, 9:27 PM
    Setting
    ensure => link
    calls the
    mklink
    method. • https://github.com/puppetlabs/puppet/blob/7.17.0/lib/puppet/type/file/ensure.rb#L104
    mklink
    then just replaces the link and doesn’t look for
    replace
    at all: • https://github.com/puppetlabs/puppet/blob/7.17.0/lib/puppet/type/file/target.rb#L34-L61
  • t

    tvaughan

    06/17/2022, 9:28 PM
    Was it already a link?
  • t

    tvaughan

    06/17/2022, 9:28 PM
    But yeah, that seems wrong either way actually
  • j

    jhoblitt

    06/17/2022, 9:29 PM
    ya, trivial to reproduce with
    Copy code
    file { '/foo/foo':
      ensure  => link,
      replace => false,
      target  => 'bar',
    }
  • j

    jhoblitt

    06/17/2022, 9:29 PM
    and then
    ln -snf baz /foo/foo
  • j

    jhoblitt

    06/17/2022, 9:29 PM
    and then
    ln -snf baz /foo/foo
  • t

    tvaughan

    06/17/2022, 9:29 PM
    Yeah, the docs seem to indicate that links shouldn't be replaced if they exist
  • t

    tvaughan

    06/17/2022, 9:29 PM
    https://puppet.com/docs/puppet/7/types/file.html#file-attribute-replace
  • n

    natemccurdy

    06/17/2022, 9:30 PM
    This bit is the key:
    but whose content doesn’t match what the
    source
    or
    content
    attribute
    Which implies the docs were written with the assumption that you’re replacing a symlink with a file (
    ensure => file
    ) that has contents.
  • n

    natemccurdy

    06/17/2022, 9:31 PM
    Those docs weren’t written to account for the case where the existing thing is already a symlink and you’re making another symlink.
  • t

    tvaughan

    06/17/2022, 9:31 PM
    Hrm...yeah, I think that nuance is a bit too subtle
  • t

    tvaughan

    06/17/2022, 9:32 PM
    Because the content of a symlink is an inode
  • j

    jhoblitt

    06/17/2022, 9:32 PM
    I got there... but not until after looking at the source
  • n

    natemccurdy

    06/17/2022, 9:32 PM
    Those docs weren’t written to account for the case where the existing thing is already a symlink and you’re making another symlink.
  • j

    jhoblitt

    06/17/2022, 9:32 PM
    which completely violates the boundary between a type and provider
  • t

    tvaughan

    06/17/2022, 9:32 PM
    Eh...there is no boundary in reality 😄
  • n

    natemccurdy

    06/17/2022, 9:33 PM
    oh look: https://tickets.puppetlabs.com/browse/PUP-10214
    👍 1
  • j

    jhoblitt

    06/17/2022, 9:34 PM
    https://github.com/puppetlabs/puppet/pull/8643
  • j

    jhoblitt

    06/17/2022, 9:34 PM
    https://github.com/puppetlabs/puppet/pull/8643
  • n

    natemccurdy

    06/17/2022, 9:34 PM
    Ah, here’s the still-open ticket that the above was marked as a duplicate of: https://tickets.puppetlabs.com/browse/PUP-6998
  • n

    natemccurdy

    06/17/2022, 9:34 PM
    From 3.8 facepalm
  • t

    tvaughan

    06/17/2022, 9:34 PM
    LoL
  • j

    jhoblitt

    06/17/2022, 9:35 PM
    abandon hope and use an exec
  • j

    jhoblitt

    06/17/2022, 9:36 PM
    @josh What sort of bribery is needed to get this PR merged? https://github.com/puppetlabs/puppet/pull/8643 I assume it needs tests
  • j

    jhoblitt

    06/17/2022, 9:36 PM
    @josh What sort of bribery is needed to get this PR merged? https://github.com/puppetlabs/puppet/pull/8643 I assume it needs tests
1...747576...428Latest