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

agent command line options ignored running under systemd

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PUP 3.7.4
    • Fix Version/s: PUP 3.8.2, PUP 4.2.2
    • Component/s: None
    • Labels:
    • Environment:
      • CentOS 7
      • puppet 3.7.4
      • ruby 2.0.0p353
    • Template:
    • Story Points:
      1
    • Sprint:
      RE 2015-08-12
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Hide
      Having {} around variables in a systemd service file makes systemd treat it as a single argument, which breaks when used for something like PUPPET_EXTRA_OPS in the puppet agent and server systemd files. When passing more than one argument in using that variable, systemd would treat it as a single variable, which puppet would ignore as invalid. Removing the {} from the variable addresses this issue. This was fixed in Puppet 4 and this ticket backported the fix to 3.x.
      Show
      Having {} around variables in a systemd service file makes systemd treat it as a single argument, which breaks when used for something like PUPPET_EXTRA_OPS in the puppet agent and server systemd files. When passing more than one argument in using that variable, systemd would treat it as a single variable, which puppet would ignore as invalid. Removing the {} from the variable addresses this issue. This was fixed in Puppet 4 and this ticket backported the fix to 3.x.

      Description

      Command line options can be added to systemd start agent within
      /etc/sysconfig/puppet and it seemingly works however when
      the agent starts all the options are silently ignored.

      PUPPET_EXTRA_OPTS="--masterport=8150"
      

      Results in systemd showing in the process table:

       /usr/bin/ruby /usr/bin/puppet agent  --masterport=8150 --no-daemonize
      

      However once running the --masterport (or any other option) is ignored.

      puppet-agent[15763]: Using cached connection for https://it-puppet-masters-public-b.cern.ch:8140
      puppet-agent[15763]: Caching connection for https://it-puppet-masters-public-b.cern.ch:8140

      The port number above is wrong and was taken from puppet.conf file.

      This seems to be related to environment. If

       /usr/bin/ruby /usr/bin/puppet agent  --masterport=8150 --no-daemonize
      

      is executed on the command line then everything works as expected
      and the puppet agent correctly talks to port 8150.

      puppet is so called simple service in systemd speak and systemd basically runs the above command as is.

      Environment of puppet agent running under systemd

      PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
      LANG=en_US.UTF-8
      PUPPET_EXTRA_OPTS=--ca_port=8140 --masterport=8150
      

      Running on the CLI.

      BASH_FUNC_module()=() {  eval `/usr/bin/modulecmd bash $*`
      CVS_RSH=ssh
      GT_PROXY_MODE=old
      HISTCONTROL=ignoredups
      HISTSIZE=1000
      HOME=/root
      HOSTNAME=lxplus302.cern.ch
      KDEDIRS=/usr
      KRB5CCNAME=FILE:/tmp/krb5cc_0_brrMbMkoqi
      LANG=en_US.UTF-8
      LCG_GFAL_INFOSYS=lcg-bdii.cern.ch:2170
      LESSOPEN=||/usr/bin/lesspipe.sh %s
      LOADEDMODULES=
      LOGNAME=root
      MAIL=/var/spool/mail/root
      MODULEPATH=/usr/share/Modules/modulefiles:/etc/modulefiles
      MODULESHOME=/usr/share/Modules
      MYPROXY_SERVER=myproxy.cern.ch
      PATH=/usr/sue/sbin:/usr/sue/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
      PWD=/root
      QT_GRAPHICSSYSTEM_CHECKED=1
      QT_GRAPHICSSYSTEM=native
      QT_PLUGIN_PATH=/usr/lib64/kde4/plugins:/usr/lib/kde4/plugins
      SELINUX_LEVEL_REQUESTED=
      SHELL=/bin/bash
      SHLVL=1
      SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
      SSH_AUTH_SOCK=/tmp/ssh-oUvgH7Tp7L/agent.26480
      SSH_CLIENT=188.184.66.232 52945 22
      SSH_CONNECTION=188.184.66.232 52945 188.184.68.74 22
      SSH_TTY=/dev/pts/0
      TERM=screen-256color
      USER=root
      _=/usr/bin/ruby
      VIRTUALENVWRAPPER_HOOK_DIR=/root/.virtualenvs
      VIRTUALENVWRAPPER_PROJECT_FILENAME=.project
      VIRTUALENVWRAPPER_SCRIPT=/etc/profile.d/virtualenvwrapper.sh
      WORKON_HOME=/root/.virtualenvs
      XDG_RUNTIME_DIR=/run/user/0
      XDG_SESSION_ID=131
      XMODIFIERS=@im=ibus
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                qa qa
                Reporter:
                traylenator Steve Traylen
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Zendesk Support