This message was deleted.
# puppet
s
This message was deleted.
b
Let's annotate that just a little bit.
Copy code
[root@tur-ds-dev4 opt]# puppet agent -t --no-noop
Info: Using environment 'dev'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Starting Facter
Copy code
Info: Loading facts
symlink_realpath(/opt/dspace_src/latest) realpath() failed: No such file or directory
symlink_realpath(/opt/dspace_src/latest) realpath() failed: No such file or directory
symlink_realpath(/opt/dspace_src/latest) realpath() failed: No such file or directory
symlink_realpath(/opt/dspace_src/latest) realpath() failed: No such file or directory
Ending Facter Starting Puppet
Copy code
Info: Applying configuration version 'rhs-dev-4d60c0c4835'
Notice: /Stage[main]/Dspace_modern/File[/opt/dspace_src]/ensure: created (corrective)
Notice: /Stage[main]/Dspace_modern/File[/opt/dspace_src/latest]/ensure: created (corrective)
Notice: Applied catalog in 6.64 seconds
[root@tur-ds-dev4 opt]#
1
remove the symlink resource and run your test and I suspect you'll get very nearly the same results.
do you have custom facts in this module?
p
@binford2k: No custom facts that I’m aware of (we’re using the Puppet master bundled with Redhat Satellite). And don’t have any specified in the Foreman UI
b
ok. What does
puppet facts
do?
1
just for comparison, this is what the error would look like if the problem was actually with the symlink target not being present
Copy code
Error: Could not set 'link' on ensure: No such file or directory @ dir_chdir - /opt/dspace_src (file: /Users/ben.ford/tmp/blahblah/dspace.pp, line: 17)
1
p
Appreciate the help. The output of puppet facts is huge - can I just paste it here ?
b
I suspect that the first handful of lines will be
Copy code
symlink_realpath(/opt/dspace_src/latest) realpath() failed: No such file or directory
p
Assuming that this is on the host which is running the agent (tur-ds-dev4 in my case), and just on the interactive shell. I’m just getting:
i.e. None of those error messages (even if I manually kill off /opt/dspace_src, i.e. rm -Rf /opt/dspace_src)
Hmmm - I guess it has to be some interaction between facter and the puppet master though
b
interesting. Ok. What happens if you trim your manifest down to --only-- the archive resource?
1
p
Going with this:
Copy code
class dspace_modern (
  $config = [],
) {
    file { '/opt':
      ensure => 'directory',
    }

    file { '/opt/dspace_src':
      ensure  => 'directory',
      owner   => 'tomcat',
      group   => 'tomcat',
      require => File['/opt'],
    }

    archive { '/tmp/dspace-7.5.tar.gz':
      source       => '<https://github.com/DSpace/DSpace/archive/refs/tags/dspace-7.5.tar.gz>',
      extract      => true,
      extract_path => '/opt/dspace_src',
      cleanup      => true,
      user         => 'tomcat',
      group        => 'tomcat',
      require      => File['/opt/dspace_src'],
    }
}
And will manually kill off /opt/dspace_src prior to the run
With that I get:
Copy code
[root@tur-ds-dev4 opt]# puppet agent -t --no-noop
Info: Using environment 'dev'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Info: Loading facts
Info: Caching catalog for <http://tur-ds-dev4.massey.ac.nz|tur-ds-dev4.massey.ac.nz>
Info: Applying configuration version 'rhs-dev-7b9dc0675fa'
Notice: /Stage[main]/Dspace_modern/File[/opt/dspace_src]/ensure: created (corrective)
Notice: /Stage[main]/Dspace_modern/Archive[/tmp/dspace-7.5.tar.gz]/ensure: download archive from <https://github.com/DSpace/DSpace/archive/refs/tags/dspace-7.5.tar.gz> to /tmp/dspace-7.5.tar.gz and extracted in /opt/dspace_src with cleanup (corrective)
Notice: Applied catalog in 8.40 seconds
And the archive has been successfully extracted (all on the first run):
b
what version of Puppet?
p
It’s all bundled as part of a solution from Redhat, but it is:
Copy code
[root@tur-ds-dev4 dspace_src]# puppet -V
6.26.0
b
and facter?
p
Copy code
[root@tur-ds-dev4 dspace_src]# facter -v
3.14.22 (commit 4d4afa91b226dfa8d2f92c495b7070377134386f)
b
and
/opt/puppetlabs/puppet/bin/ruby --version
?
p
Copy code
[root@tur-ds-dev4 dspace_src]# /opt/puppetlabs/puppet/bin/ruby --version
ruby 2.5.9p229 (2021-04-05 revision 67939) [x86_64-linux]
b
wow, ruby's a big repo
😄 1
huh. I cannot find the string
symlink_realpath
in any of Puppet, Facter, or Ruby
p
Hmmm - Let me put that symlink resource back in, and screenshot what I get
So the only change to the above is the inclusion of the following lines:
Copy code
file { '/opt/dspace_src/latest':
      ensure  => 'link',
      target  => '/opt/dspace_src/DSpace-dspace-7.5',   # When dspace-7.5.tar.gz is extracted (from above), it has directory 'DSpace-dspace-7.5' inside of it
      require => Archive['/tmp/dspace-7.5.tar.gz'],
    }
Rinse repeat involves killing off /opt/dspace_src (i.e. simulate a fresh run)
Wondering whether thowing in a “-d” would help (debug)
b
it might
--trace could too
what does
grep dspace /opt/puppetlabs/puppet/cache/lib/facter/ -rn
say on the agent?
p
That’s empty (i.e. just returns without a match)
Apologies - but PDF seemed to be the easiest way here 🙂
[Aside: I could normally live with something like this, but it becomes an issue because I’m trying to string together multiple Archive resources along with symlinks in this way. The product has separate TGZ for the UI, API etc.]
b
oh selinux my old friend
p
Ah okay - yes we do run it in permissive mode
Should I temporarily disable it on the agent and see what happens ?
b
worth giving it a shot.
1
p
How very interesting
b
what doesn't make sense to me is the order of the log messages. All the selinux log messages and warnings show before the message indicating that the agent even finished downloading the catalog. This might be getting into @csharpsteen territory 😁 (he'll be on in the morning)
p
Disabling it and rebooting:
b
haha, that's so often my response when working with selinux
😄 1
p
Everything is behaving as it should!
b
heh. Well, we've at least identified where the problem lies lolwut
1
p
Thank you Sir! Yes, good to at least isolate the issue. In practise we’re supposed to have SELinux enabled (at least for prod - I know it’s permissive but there’s auditing of that). Dev is fine to turn it off
b
if this is a reasonable place to 📌 tonight, maybe Charlie can give you some hints tomorrow.
🙌 1
p
Yeah - I couldn’t see where I was going wrong with the Puppet code. Thank you for taking the time to isolate things with me
👍 1
c
No such file or directory
seems perfectly reasonable during fact collection if those file paths are created later when the catalog is applied. If disabling SELinux silenced those errors, then it seems likely that SELinux in permissive mode is intercepting the system call and causing it to return an abnormal exit code that the Fact logic does not handle. As for how to work around or resolve that, you'll need to determine what exact change SELinux is causing in the behavior of that function.