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

Add core example for body inheritance

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Done
    • Priority: (None)
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.15.4, 3.18.0
    • Component/s: Documentation
    • Labels:
      None

      Description

      It would be nice if there were a functional example in the docs illustrating body inheritance. Currently, the example shown is not runnable.

      https://groups.google.com/g/help-cfengine/c/WpDuScsMxxI

      this topic puzzles me for quite a long time.

      lets say i have this classes body:

      body classes set_some_fancy_classes ( x, y)
      {
      promise_kept => { "some_fancy_class_${x}_ ${y} _kept" };
      promise_repaired => { "some_fancy_class ${x} ${y} _repaired" };
      repair_failed => { "some_fancy_class ${x} ${y} _notkept" };
      repair_denied => { "some_fancy_class ${x} ${y} _notkept" };
      repair_timeout => { "some_fancy_class ${x} ${y} _notkept" };
      }

      which is used like this:

      commands:
      "/bin/true"
      handle => "some meaningful string",
      classes => set_some_fancy_classes( "$(this.promiser)", "$(this.handle)" );

      so far so good, the one thing that i dont get is, how do i set "additional" classes in this scenario, for example i want to set another class like this (not handled by the mentioned classes body):

      commands:
      "/bin/true"
      handle => "some meaningful string",
      classes => set_some_fancy_classes( "$(this.promiser)", "$(this.handle)" ),
      classes = if_repaired("some_class_ to_handle_dependencies");

      problem is, "last one wins" rule is firing, so no luck here.

      i read about the "inherit_from" attribute, but i have no clue how to implement this or if it is possible anyway. the documentation / examples left me clueless.

      i want to set the classes from the " set_some_fancy_classes" body PLUS the class from the "if_repaired" attribute.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Summary Panel