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

Allow environment in body agent control to be set to an empty list

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Open
    • Priority: (None)
    • Resolution: Unresolved
    • Affects Version/s: 3.15.0, 3.18.0, 3.19.0
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      Description

      It's valid for environment in body agent control to not be defined, but an error is emitted if the attribute is set to an empty list.

         error: Empty list is not a valid value for 'environment' attribute in agent control body
      

      Example Policy

      body agent control
      {
            # Environment variables of the agent process.
            # The values of environment variables are inherited by child commands
            environment => { @(def.control_agent_environment_vars) };
      }
      bundle common def
      {
          any::
      
            "control_agent_environment_vars" ->  { "CFE-3925" }
              slist => { },
              if => not( isvariable( "control_agent_environment_vars" ) ),
              comment => concat( "Environment variables of the agent process. The values",
                                 " of environment variables are inherited by child commands.",
                                 " This promise sets the default to a list with an empty element since it is illegal to set an empty list. n empty list.",
                                 " Use Augments to override this default" );
      }
      

      Current possible workarounds:

      • class guard the setting of environment in body agent control
      • insert a dummy variable to be defined by default

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              a10042 Nick Anderson
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated: