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

As a policy writer I would like to be able to reliably find the path to the directory of the first policy file read

    XMLWordPrintable

    Details

    • Type: Story
    • Status: Done
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.12.0
    • Component/s: None
    • Labels:

      Description

      It would be very useful to have a variable that contained the path to the directory so that other variables in policy do not rely on specific fully qualified paths and can instead be relative to our policy root.

      We have sys.inputdir and this.promise_dirname but they do not quite cover the use case.

      sys.inputdir is either /var/cfengine/inputs or $HOME/.cfagent/inputs depending on the executing user. The path can be overridden with the use of --workdir but that is less friendly than automatically populating a variable.

      this.promise_dirname dosn't quite cover the use because you have to add new policy and that new policy must know its relative position to the entry file.

      I suggest sys.policy_entry_dirname.

      for example:

      cd /tmp
      cf-promises -cf ./mypolicy.cf
      

      sys.policy_entry_dirname = /tmp

      cf-promises -cf /tmp/mypolicy.cf
      

      sys.policy_entry_dirname = /tmp

      # cf-promises -c
      

      sys.policy_entry_dirname = /var/cfengine/inputs/

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                vpodzime Vratislav Podzimek
                Reporter:
                a10042 Nick Anderson
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Summary Panel