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

As a policy writer I would like to be able to handle "events" natively

    XMLWordPrintable

    Details

    • Type: Story
    • Status: Need more Info
    • Priority: Medium
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      The idea stemmed from a discussion on the help list.

      •  Native event handling will make event-driven policy easier. This is for the cases where you don't know in advance all the things you need to do, and you may not even be able to do them yet.
      • Clearing events would be the same as canceling a class. Event handlers would be special because they are called when an event is created, and consume (cancel) the event.
      • Consuming an event doesn't prevent it from being consumed again, if it's created again. In CFEngine terms, events are divergent and convergence clears them.

      Policy Specification:

      bundle agent main
      {
        classes:
          "modified_unit"
            metatags => { "systemd_reload" },
            event => "true"; # Can bundle scoped classes trigger events?
      }
      
      bundle agent my_systemd_handler
      # @brief Collection of promises that should
      # be made automatically based on event classes that are defined.
      {
        meta:
          "events_handler"      slist => { "systemd_reload" };
          "handler_execution" string => "atend";
      }
      

      Potential Use cases:

      • TAP and jUnit tests
      • restart daemons like systemd once even though multiple files require it across multiple bundles
      • send messages to the user once instead of N times
      • respond to a change in state across libraries (especially when you don't own some of them!) through a common event API
      • collect data from multiple sources in policy to build a single data structure, e.g. make a list of all the users added in multiple bundles in order to record that list for auditing
      • supply internal C handlers in the agent for some specific events, providing a loosely coupled "dropbox" API

      ...plus more interesting phase 2 possibilities if we can develop a message bus. Like hub orchestration across hosts, integration with imperative tools like Ansible, and swarm behavior where hosts coordinate with each other without central authority.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                a10042 Nick Anderson
                Reporter:
                a10042 Nick Anderson
              • Votes:
                1 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Summary Panel