ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent-MP/bin/aemp
(Generate patch)

Comparing AnyEvent-MP/bin/aemp (file contents):
Revision 1.23 by root, Sun Aug 30 18:15:49 2009 UTC vs.
Revision 1.24 by root, Sun Aug 30 18:51:49 2009 UTC

50 aemp addservice <initfunc> # add an instance of a service 50 aemp addservice <initfunc> # add an instance of a service
51 aemp delservice <initfunc> # delete one instance of a service 51 aemp delservice <initfunc> # delete one instance of a service
52 52
53 # profile-specific configuration 53 # profile-specific configuration
54 aemp profile <name> <command>... # apply command to profile only 54 aemp profile <name> <command>... # apply command to profile only
55 aemp parent <name> # specify a parent profile
55 aemp delprofile <name> # eradicate the named profile 56 aemp delprofile <name> # eradicate the named profile
56 aemp showprofile <name> # display given profile 57 aemp showprofile <name> # display given profile
57 aemp showconfig <name> # display effective config 58 aemp showconfig <name> # display effective config
58 59
59=head1 DESCRIPTION 60=head1 DESCRIPTION
339 340
340=item delprofile <name> 341=item delprofile <name>
341 342
342Deletes the profile of the given name. 343Deletes the profile of the given name.
343 344
345=item parent <name>
346
347Sets the parent profile to use - values not specified in a profile will be
348taken from the parent profile (even recursively, with the global default
349config being the default parent). This is useful to configure profile
350I<classes> and then to inherit from them for individual nodes.
351
352Note that you can specify circular parent chains and even a parent for the
353global configuration. Neither will do you any good, however.
354
355Example: inherit all values not specified in the C<doomed> profile from
356the C<server> profile.
357
358 aemp profile doomed parent server
359
360=item delparent
361
362Removes the parent again from the profile, if any was set, so the profile
363inherits directly from the global default config again.
364
344=item showprofile <name> 365=item showprofile <name>
345 366
346Shows the values of the given profile, and only those, no inherited 367Shows the values of the given profile, and only those, no inherited
347values. 368values.
348 369
349=item showconfig <name> 370=item showconfig <name>
350 371
351Shows the I<effective> config, i.e. the values as used by a node started with the given profile name. 372Shows the I<effective> config, i.e. the values as used by a node started
373with the given profile name.
374
375If the name is omitted, show the global default config.
352 376
353=back 377=back
354 378
355=cut 379=cut
356 380
619 643
620 setservices => sub { 644 setservices => sub {
621 @ARGV >= 1 645 @ARGV >= 1
622 or die "service specifications missing\n"; 646 or die "service specifications missing\n";
623 $profile->{services} = [split /,/, shift @ARGV]; 647 $profile->{services} = [split /,/, shift @ARGV];
624 @ARGV = ();
625 ++$cfg->{dirty}; 648 ++$cfg->{dirty};
626 }, 649 },
627 delservices => sub { 650 delservices => sub {
628 delete $profile->{services}; 651 delete $profile->{services};
629 ++$cfg->{dirty}; 652 ++$cfg->{dirty};
661 my $name = shift @ARGV; 684 my $name = shift @ARGV;
662 685
663 delete $cfg->{profile}{$name}; 686 delete $cfg->{profile}{$name};
664 ++$cfg->{dirty}; 687 ++$cfg->{dirty};
665 }, 688 },
689 parent => sub {
690 @ARGV >= 1
691 or die "profile name is missing\n";
692
693 $profile->{parent} = shift @ARGV;
694 ++$cfg->{dirty};
695 },
696 delparent => sub {
697 delete $profile->{parent};
698 ++$cfg->{dirty};
699 },
666 showprofile => sub { 700 showprofile => sub {
667 @ARGV >= 1 701 @ARGV >= 1
668 or die "profile name is missing\n"; 702 or die "profile name is missing\n";
669 my $name = shift @ARGV; 703 my $name = shift @ARGV;
670 704
671 print JSON::XS->new->pretty->encode ($cfg->{profile}{$name} || {}); 705 print JSON::XS->new->pretty->encode ($cfg->{profile}{$name} || {});
672 }, 706 },
673 showconfig => sub { 707 showconfig => sub {
674 my $name = @ARGV ? shift @ARGV : AnyEvent::MP::Kernel::_nodename; 708 my $name = @ARGV ? shift @ARGV : AnyEvent::MP::Kernel::_nodename;
675 709
710 my $profile = AnyEvent::MP::Config::find_profile $name;
711
712 # make it look nicer:
713 delete $profile->{profile};
714 delete $profile->{parent};
715
676 print JSON::XS->new->pretty->encode (AnyEvent::MP::Config::find_profile $name); 716 print JSON::XS->new->pretty->encode ($profile);
677 }, 717 },
678); 718);
679 719
680sub docmd { 720sub docmd {
681 my $cmd = shift @ARGV; 721 my $cmd = shift @ARGV;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines