Hi all

I was quite excited to see people talking again on lssconf. I read with interest that the authors of bcfg2 and puppet feel they could consume the neutral configuration format that Paul and I proposed last year. So I got to thinking what a pity it was that noone seems to have written a high level tool to test these suppositions.

It is now 3 days since I thought what a shame it was. In that time, I have written a little over 2.5k lines of code, and I have a tool called mcfg. I can't make too many claims about mcfg. It probably leaks memory... i spent at least a few hours running it through valgrind and efence but I doubt that caught all the holes. It's really very simple, and it lacks a lot of nice features that e.g. the lcfg compiler has. However, it is small, independent, possibly clean and standard compliant.

I think it might just implement enough functionality that it could be used for real, as an alternative to implementing your own classing mechanism for scratch, if you were starting scripting. Perhaps it will form a minimal level for people to work with. Now I just need to find out if puppet and bcfg can work with it, and we would (for the first time) have split the problem into two parts. I'm sure there are many things that people believe are key to solving this problem, but in my opinion, the biggest difficulty is that to be a useful tool right now it has to do too much for a sysadmin to be able to maintain and export it.

I don't have an ftp site to post this on, but if anyone wants the source code, feel free to mail me. Rather than write a long description here, I've taken the liberty of attaching the (poorly) htmlified man page, so that people can see if its of interest. Nb what I have is source code. You'll need a decent version of bison, flex, gcc and probably you'll need glibc for get_long_opt.

Ed
Title: Manpage of MCFG
Content-type: text/html

MCFG

Section: (1)
Updated: October 2006
Index Return to Main Contents
 

NAME

mcfg - miniature aspect compiler  

SYNOPSIS

mcfg
[-b] [-c] [-h] [-v] [-V]
[-o [ output_file ]]
[-r resource_file ]
[-t target_compiler ]
[-x target_version ]
[ files ]

 

DESCRIPTION

mcfg is an experimental aspect compiler for creating XML node configurations from a set of site description files. It is an example of a high level system configuration tool, in that it does not specify any way to instantiate given a configuration on a node. A low-level tool is required to take the node configuration files that mcfg outputs and configure a machine with them.

mcfg accepts a very simple section structured language. Each section defines values for either a named node or a named aspect. Each node or aspect can be defined by multiple sections, and all sections referencing the same named node or aspect are collated. Every node or aspect also has a set of parent aspects from which it inherits values, and each section may add aspects to this set.

node|aspect <name> [ inherits <aspect_names> ... ] {

   ...
}

Each section contains a set of assignments to resources, where a resource is a named location, for example lqmail_server.iprq. It is up to the target tool to interpret the resources and configure a node (and up to that tool what resources are valid). A resource may be either a map or a scalar, where a map is a collection of resources. In this way, resources form a multi-rooted tree. To assign to a member of a map, use dot-notation, lq.rq, for example lqa.brq refers to the member resource b of resource a.

Assignments may be of two basic kinds. A scalar assignment lq=rq specifies a value for a scalar resource. Use double quotes to allow spaces and reserved words as values. A map constraint is a constraint on the values that its scalar resource members may take. The assertion operator lq=+rq marks a value as necessary for some scalar member of the resource to take on. The retraction operator lq=-rq marks a value as unsuitable for any scalar member of the resource to take on.

Each assignment may be marked with a priority, which can be used to resolve which assignments form a part of the final configuration. In the compile phase, for each node, all the aspects it inherits from are determined, and the best assignments chosen. In general, mcfg will use the highest priority assignment for a scalar, and if two assignments have the same priority, it will use the assignment closest to the node (most nearly inherited). This is complicated by map constraints which can disqualify scalars from taking on certain values if the constraint has high enough priority, and is local enough. Finally, in the event that a value is necessarily taken on by some member of a map, and no scalar takes on that value, an unnamed map member will be created with the value.

<scalar> = <value> [ : minimum|low|standard|high|maximum ]
<map> =+|=- <values> [ : minimum|low|standard|high|maximum ]

There also exist references, which may take the place of any value. A reference takes the form of the resource name preceded by a lq$rq, for example lq$a.brq. A reference is replaced by the final computed value of the resource it points to. In the event of a reference to a map, all final values of all member scalar resources it contains will be used as values in the assignment.

 

OPTIONS

-b
Brief. Print nothing to stdout. Fatal error messages will go to stderr.
-c
Context analysis. If verbose, print all contexts, and what their parents are to stdout. If used with -r, add this information to the resource analysis file.
-h
Help. Display usage information and exit.
-v
Verbose. Print the resource analysis to stdout, plus context analysis if -c is given.
-o [ prefix ]
Output other. For each node profile, write a text version too. If prefix is given, prepend it to the names of these text files.
-r file
Resources. Write the resource analysis to file. Resource analysis is the structure of all assignments and constraints, before they are compiled to form profiles (mcfg works by compiling this state over and over, each time for a different node).
-t target
Target lexicon. Mark the generated profiles as targetted at this tool or lexicon.
-x version
Target version. Specify the particular version of tool or lexicon which is targetted.

 

RETURN VALUES


 0 
on success.
-1
on an invocation error (command-line).

 1
on a lexing error (invalid characters).

 2
on a parsing error (syntactic error).

 3
on a compile error (semantic error).

 

EXAMPLES

Example 1 (test_data/man_ex1.mcf)
Here we assume a low level tool can set the mail server and nfs server from the values servers.mailserver and servers.nfs. The host bar.example.com simply inherits all its values from the default lqmy home networkrq aspect, which sets up defaults. However, for host foo.example.com, the aspect lqown mailserverrq is used to signal that foo's mailserver should be itself. Note the use of references so that this aspect will work for any node inheriting it.

aspect lqmy home networkrq 
{
  servers.mailserver = lqsmtp.mydomainrq;
  servers.nfs = lqnfs.mydomainrq;
}

aspect lqown mailserverrq 
{
  servers.mailserver = $host.name: high;
}

node lqfoo.example.comrq 
        inherits lqmy home networkrq, lqown mailserverrq
{
  host.name = lqfoo.example.comrq;
}
node lqbar.example.comrq inherits lqmy home networkrq 
{
  host.name = lqbar.example.comrq;
}

 

ERRORS

Lex errors

Unterminated string constant
Values cannot span lines, even within quotes.
String constant truncated
mcfg ran out of memory trying to buffer a quoted value. It isn't expected that you will ever see this.
Unknown escape sequence
mcfg only supports two escape sequences, \\ and \lq. In particular, no new lines or octal escape sequences are allowed.
Unexpected characters
This is returned when characters in the file do not form any possible token of the mcfg language (You may have forgotten quotes around a value or inadvertantly corrupted the file).

Parse errors

Context context inherits from itself
One of the proposed parents for this aspect has this aspect as a ancestor at some level of removal. This is now allowed
resource was previously used as raw
One of the elements in an extended resource name has already been used as a scalar. Types for resources are fixed as soon as any assignment is seen. For example you have tried to do something with foo.a.b, but foo.a has already been used as a scalar.
Cannot use lq=rq on list resource
The scalar assignment operator can only be used on scalar resources. The resource it has been used on here has already been used as a map.
Cannot set a scalar resource to multiple values (forgot quotes?)
A scalar assignment may specify exactly one value. You will see this error message if you set the value to a string and forget double quotes.

Cannot use list op lq=+rq on scalar resource

Cannot use list op lq=-rq on scalar resource
The map assignment operators cannot be used on scalar resources. The resource you are assigning to has already been used as a scalar.
Cannot use lqunsetrq in list constraint for resource
The list of values for a map constraint may not include the keyword unset, meaning that the value is undefined.

Compile errors

Attempt to reference a list resource from a scalar
A scalar resource can only allowable reference other scalar resources, since scalar assignment requires a single value.
resource involves cyclic dependencies
A resource cannot depend upon another resource which in turn, at some remove, depends upon it again. One resource must be calculable in the absence of the other; that resource will be calculated, then the other.
Non-deterministic list constraints for resource
The decision whether to add an unnamed scalar member resource to a map cannot be made deterministically, because you have specified both that the value must necessarily be present and that it must necessarily not, with equal precedence.
Value for resource non-deterministic
The value for a scalar resource cannot be decided deterministically, because other assignments with equal precedence make the choice arbitrary.
Rival value for resource has equal precedence
In this case, there is more than one value for the resource with the same (best) precedence, and the choice between them is arbitrary.
Constraint for resource has equal precedence
A constraint ruling out the optimal value has the same precedence as the optimal value, and the choice between them is arbitrary.
Constraint outcome for resource non-deterministic
Whether or not there is an allowable assignment is unknown because there are constraints specifying both that a value is necessarily present and necessarily not present with equal precedence.
Rival constraint for resource has equal precedence
There is a best assignment, but the constraints that govern it cannot be determined. The best assignment has the same precedence as both the strongest constraint requiring its absence and the strongest constraint requiring its presence.

 

STANDARDS

mcfg generates configurations compatible with the standard format proposed in [1]. Although all generated configurations are valid, mcfg cannot generate all possible node configurations, as it cannot construct unnamed maps.

[1]
lqConfiguration Tools: Working Togetherrq, Paul Anderson and Edmund Smith, Proceedings of LISA XIX, 2005.

 

BUGS

This implementation probably leaks memory.

 

AUTHOR

This manual page was written by Edmund Smith <[EMAIL PROTECTED]>.


 

Index

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
RETURN VALUES
EXAMPLES
ERRORS
STANDARDS
BUGS
AUTHOR

This document was created by man2html, using the manual pages.
Time: 03:19:57 GMT, October 17, 2006
_______________________________________________
lssconf-discuss mailing list
lssconf-discuss@inf.ed.ac.uk
http://lists.inf.ed.ac.uk/mailman/listinfo/lssconf-discuss

Reply via email to