From the `Unable to interpret argument` message, i...
# puppet
c
From the
Unable to interpret argument
message, it sounds like you may have used
--
as well. That terminates flag processing, so you have to make sure
-s
is behind it if used.
v
ahead?
c
I always think of flags as consuming the argument in front of them, so behind makes sense to me 🤷‍♂️
v
in context of
--
j
the exact command i typed was
Copy code
bash install.bash -s extension_requests:pp_environment=prod
c
I think
-s
is only needed when piping into bash:
curl ... | bash -s ...
j
i did find a typo (i missed the
pp_
in the middle of the option string), after fixing that the error message doesn't happen, but the CSR isn't created.
Copy code
# puppet agent --fingerprint
Fingerprint asked but neither the certificate, nor the certificate request have been issued
also tried without the
-s
, i.e.
Copy code
bash install.bash extension_requests:pp_environment=prod
still no CSR
and no
csr_attributes.yaml
file ... in fact
find / -name csr\*
doesn't find anything on the machine at all
v
should be /etc/puppetlabs/puppet/csr_attributes.yaml
j
i agree, it should be that. but it's not there.
v
I never used script that way, sorry, I tend to create it myself
since I create it based on ec2 instance tags
j
if it were just me i would probably do the same, but i'm trying to come up with a process that other people can handle, since developers and QA people are supposed to be able to stand up their own machines by following directions that i write, and some of them have little-to-no experience with the linux command line. i'm trying to give them command lines that they can just copy and paste, i don't want them to have to use a text editor.
v
I wonder if script actually expects to read arguments from standard input
and you don't do that
c
Hmm, are you trying to do this with PE 2016.2? Looks like support for
extension_requests
was added in 2016.4.
j
no, this is 2023.8.5
on RHEL 9
we're not currently using certificates with extra extensions, this is an idea i'm exploring to try and de-couple the concept of "dev, test, stage, production" from the "environment" mechanism (which is tied to software versions, since the puppet code is versioned with the main application code)
v
I checked myself, csr_attributes.yaml indeed is not created
j
just for grins and giggles, i ran
Copy code
find / -xdev -type f -print0 | xargs -0 grep -l pp_environment
on the machine, to see if it maybe created it in some other file ... the only two places it appears are
/root/.bash_history
and
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppt/ssl/oids.rb
... so basically, adding the extra option did nothing.
(for puppet people, i just opened case 01439281 about this)
v
@csharpsteen. there is a function defined, but it is not called anywhere
Copy code
# grep puppet_config_set install.bash 
puppet_config_set() {
c
Hmm, just tried PE 2023.8.5 and RHEL 9 and it appears to be working:
Copy code
[root@bluff-camp ~]# curl -ksLO https://cackly-surveyor.delivery.puppetlabs.net:8140/packages/current/install.bash

[root@bluff-camp ~]# bash install.bash extension_requests:pp_environment=prod
...

[root@cackly-surveyor puppet-enterprise-2023.8.5-el-9-x86_64]# puppetserver ca sign --all
Successfully signed the following certificate requests:
  bluff-camp.delivery.puppetlabs.net

[root@bluff-camp ~]# puppet ssl download_cert
Notice: Downloaded certificate 'bluff-camp.delivery.puppetlabs.net' with fingerprint (SHA256) 23:9A:4E:F1:EA:12:F4:6A:F0:0E:86:C9:F2:CA:CD:EE:88:A8:DC:FF:C1:B9:C6:70:85:91:9E:90:13:0F:9F:B9

[root@bluff-camp ~]# cat /etc/puppetlabs/puppet/csr_attributes.yaml
---
extension_requests:
  pp_environment: 'prod'

[root@bluff-camp ~]# openssl x509 -in "$(puppet config print hostcert)" -noout -text |grep -FA1 1.3.6.1.4.1.34380.1.1.12
            1.3.6.1.4.1.34380.1.1.12:
                ..prod
v
Hmm, must be called out of another script somewhere
j
huh
so i just did a "full reset" and tried it again, this time it created the
csr_attributes.yaml
file and ran
curl -k ... | sudo bash -s extension_requests:pp_environment=prod
... this time it worked, and
puppetserver ca list
on the server shows the CSR, waiting to be signed
the only thing i can think is, maybe the
install.bash
file i had downloaded before was from 2023.8.4 and something changed in it? i thought i had downloaded a new copy after upgrading the PE server on friday, but i wouldn't swear to it.
v
from what I can tell, install.bash does nothing but downloads another install.bsh for your os
partyyes 1
and then passes arguments there
j
yeah i saw that just now, i didn't dig into the URL it downloads yet.
found the "real" script,
el-9-x86_64.bash
, on the server ... and that calls the
puppet_config_set
function ... very strange
c
install.bash
basically just figures out which flavor of *NIX it is running on and then downloads a platform-specific script that does
yum
stuff, or
apt
stuff, etc.
j
so that leads to another question ... if the only point of
install.bash
is to download and install an OS-specific script, why does it contain a bunch of code to do more than just that? why not just build the URL and download/run the file? (and also offer a
--download
option to download the "real" script, so that paranoid people like myself can inspect that before running it?)
why does it have the function to examine command line arguments at all, if it isn't going to use them?
v
in our bootstrap script we don't use it. just configure the repo and dnf it
c
Because the feature
install.bash
is designed to deliver is "one script that takes care of installation on all platforms". It doesn't have any extra complexity that does not align with that design goal.
j
i get that ... but if all
install.bash
is doing is building the URL of the platform-specific script, downloading that, and executing it ... why does it care what the other command line arguments are? why does the
puppet_config_set
function exist in the
install.bash
script, if it isn't needed?
my guess is that (1) it used to be be a single script, (2) when it was split apart, somebody forgot to remove the extra unnecessary code, and (3) nobody has noticed until now
c
Looks like
puppet_config_set
is in
templates/partials/shared_functions.bash.erb
, which is inserted into both
install.bash
and the platform-specific scripts.
install.bash
doesn't need it, but each of the platform scripts do --- so it lives in the shared code block.
j
ah, i didn't realize the scripts were generated ... that makes more sense now