Hi.

I've successfully written and tested three puppet custom types for
managing cobbler so far (distro, repo and profile). So far it has been
interesting week, learning ruby from zero, learning custom types etc.
But I'm really satisfied with the results so far.

Now I'm trying to figure out how to write rather complex provider, so
maybe someone can help with some thoughts or input.

What am I trying to do is write a provider for a command that looks
something like this:

cobbler add system --name=blah \
  --profile=someprofile  \
  --interface=eth0 \
    --mac=SOMEMAC \
    --interface-type=bond_slave \
    --interface-master=bond0 \
  --interface=eth1 \
    --mac=SOMEMAC \
    --interface-type=bond_slave \
    --interface-master=bond0 \
  --interface-name=bond0 \
    --interface-type=bond
    --bonding-opts="miimon=300 mode=1 primary=eth0"
    --ip-address=MYIP \

As you can see, problem is that I can have multiple interfaces, and
every one of them can have some unique properties (mac, type, etc).

So, for example I don't have a clue how should a resource for something
like this look like? My first thought was:

cobblersystem { 'blah':
  profile    = 'someprofile',
  interfaces = ['eth0','eth1','bond0'],
  macs       = ['SOMEMAC1','SOMEMAC2']
  iface-opts = ['-interface-type=bond_slave
--interface-master=bond0','..','']
  ...
  ...
}

But this is just a big mess - both for reading and writing resources
itself, as is for reading and writing provider :(

Another idea was to separate resources for interfaces from the main
system resource, so that I could write something like:


cobblersysiface {'eth0':
  ...
}
cobblersysiface {'eth1':
  ...
}
cobblersystem {'eth0':
  interfaces = [Cobblersysiface['eth0'], Cobblersysiface['eth1'], ],
}

But I'm still not fully satisfied with this, because provider for
interface should contact the provider for cobblersystem, beacuse it's
that provider that runs the full "cobbler system add/edit" command.

Any ideas on this one?

Or is it too complex and should I just give up and simply use Exec type :-/

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to