Differences between revisions 6 and 7
Revision 6 as of 2008-02-22 17:17:49
Size: 2989
Editor: scott
Comment:
Revision 7 as of 2011-08-26 04:10:18
Size: 2989
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 11: Line 11:
Arguments to events used to be passed to the job processes as positional arguments, but JobEventExpressions removed this since there is no logical way to do this given the more complex event matching it allows; ["States"] reduces their usefulness even further. Since only environment is passed to job processes now, information would need to be needlessly duplicated in both. Arguments to events used to be passed to the job processes as positional arguments, but JobEventExpressions removed this since there is no logical way to do this given the more complex event matching it allows; [[States]] reduces their usefulness even further. Since only environment is passed to job processes now, information would need to be needlessly duplicated in both.

Please check the status of this specification in Launchpad before editing it. If it is Approved, contact the Assignee or another knowledgeable person before making changes.

Summary

Events currently have both arguments and environment, where arguments are used for matching in job definitions and environment is available to the job processes itself. This specification proposes removing arguments in favour of matching on environment instead.

Rationale

Arguments to events used to be passed to the job processes as positional arguments, but JobEventExpressions removed this since there is no logical way to do this given the more complex event matching it allows; States reduces their usefulness even further. Since only environment is passed to job processes now, information would need to be needlessly duplicated in both.

Scope

This scope of this specification is limited to the removal of arguments from the event, and redefining how events are matched based on environment.

Design

  • Arguments are removed from events.
  • Environment to the event is considered to have an order, thus matching may be done using this order.
    path-mounted
      PATH=/usr
    
    start on path-mounted /usr
  • Matching may also be done by variable name.
    start on path-mounted DEVICE=/dev/sd*
  • Quoting of the variable name may be done over the entire argument, or over the value part; both are equivalent.
    start on example "FOO=foo bar"
    start on example FOO="foo bar"
  • Matches on position must precede matches by name.
    start on path-mounted /usr DEVICE=/dev/sd*
  • Failure to adhere to above will result in the job definition failing to parse.
  • To match an environment variable containing an equals sign, the variable name must be used.
    start on example FOO=foo=bar
  • Job events will receive the same combination of arguments and environment, except that the arguments will now be named.
    stopped
      JOB=apache
      RESULT=failed
      PROCESS=main
      EXIT_SIGNAL=SEGV

Implementation

Code

Code changes are primarily limited to init/event.c and init/event.h.

The args member will be removed from the Event structure and code that uses it removed.

The args member of the EventOperator structure will be changed to env and code that uses it changed to match.

event_operator_match will be modified to match against the env table by position and name as described.

job_emit_event will be modified to produce the new event format.

parse_on_operand will be modified to ensure that positional arguments do not follow name-based ones.

Data preservation and migration

These changes are largely backwards compatible with the previous behaviour.

Unresolved issues


RemoveEventArguments (last edited 2011-08-26 04:10:18 by localhost)