Uploaded image for project: 'CFEngine Community'
  1. CFEngine Community
  2. CFE-2147

standard_services bundle does nothing if systemd unit file contains "${foo}"



    • Type: Bug
    • Status: Done
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.7.4
    • Component/s: Packaging
    • Labels:


      After installing the postgresql packages from http://yum.postgresql.org/9.4/redhat/rhel-7-x86_64/repoview/postgresqldbserver94.group.html, I expected to be able to start up the systemd service by writing

      "" usebundle => default:standard_services("postgresql-9.4", "start");

      But this promise has no effect.

      Running cf-agent with @-v@ showed some suspicious output:

      verbose: Function REGLIST was promised a list called '@(systemd_service_info)' but this was not found

      verbose: P: Promiser/affected object: 'standard_services: Service postgresql-9.4 unit file is not loaded; doing nothing'

      (More of the output is in the attached file)

      The claim that the "unit file is not loaded" is wrong: Running @systemctl show postgresql-9.4@ by hand tells me otherwise.

      Experimentation showed that this problem occurs only when the output of systemctl contains text of the form "${foo}". In the case of postgresql-9.4, the output contains the line

      ExecStartPre={ path=/usr/pgsql-9.4/bin/postgresql94-check-db-dir ; argv[]=/usr/pgsql-9.4/bin/postgresql94-check-db-dir ${PGDATA} ; ignore_errors=no ; start_time=[n/a] ; stop_time=[n/a] ; pid=0 ; code=(null) ; status=0/0 }

      , for example.

      Looking at the implementation of @standard_services@, the trouble appears to start here: https://github.com/cfengine/masterfiles/blob/0b431fb15df63ce7c22d9475eadc8b683af63dc8/lib/services.cf#L152

      rlindner from IRC created this minimal test case illustrating the problem: https://gist.github.com/r-lindner/0c1d8de18ba0361d0bc9

      It appears that the @string_split@ does not operate as expected when applied to text that contains what looks like a variable reference.

      I think that either @string_split@ or the @standard_services@ bundle needs to be fixed.


          Issue Links



              • Assignee:
                a10040 Kristian Amlie
                hannes Hannes Hannes
              • Votes:
                1 Vote for this issue
                6 Start watching this issue


                • Created: