/[smeserver]/rpms/e-smith-devtools/sme9/e-smith-devtools-2.4.0.bz8951.event_template-actions-services.patch
ViewVC logotype

Annotation of /rpms/e-smith-devtools/sme9/e-smith-devtools-2.4.0.bz8951.event_template-actions-services.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download)
Thu Jun 25 15:13:32 2015 UTC (8 years, 11 months ago) by stephdl
Branch: MAIN
CVS Tags: e-smith-devtools-2_4_0-4_el6_sme, e-smith-devtools-2_4_0-5_el6_sme, HEAD
* Mon Jun 22 2015 stephane de labrusse <stephdl@de-labrusse.fr> 2.4.0-4.sme
- Added new createlinks function
- event_templates event_actions event_services

1 stephdl 1.1 diff -Nur e-smith-devtools-2.4.0.old.8951/CreateLinks.pm e-smith-devtools-2.4.0.8951/CreateLinks.pm
2     --- e-smith-devtools-2.4.0.old.8951/CreateLinks.pm 2015-06-22 03:11:08.542436021 +0200
3     +++ e-smith-devtools-2.4.0.8951/CreateLinks.pm 2015-06-22 03:48:16.298307902 +0200
4     @@ -32,12 +32,15 @@
5     safe_symlink panel_link admin_common_link
6     event_link service_link_enhanced
7     safe_touch templates2events
8     + event_templates event_actions event_services
9     );
10     our %EXPORT_TAGS = (
11     all => [ qw!safe_symlink panel_link admin_common_link
12     event_link service_link_enhanced
13     - safe_touch templates2events! ]
14     + safe_touch templates2events
15     + event_templates event_actions event_services! ]
16     );
17     +
18     our $VERSION = sprintf '%d.%03d', q$Revision: 1.1 $ =~ /: (\d+).(\d+)/;
19    
20     =head1 NAME
21     @@ -192,6 +195,71 @@
22     }
23     }
24    
25     +=head2 event_templates
26     +
27     +This function creates a file tree (of empty files) which is used by the
28     +generic_template_expand action to determine which templates need to
29     +be expanded for a particular event. Takes one event argument and a
30     +list of file names, e.g.
31     +
32     + event_templates("$event", "/etc/some/file", "/etc/some/file2", "/etc/some/file3", ...);
33     +
34     +=cut
35     +
36     +sub event_templates
37     +{
38     + my ($event, @paths) = @_;
39     +
40     + foreach (@paths)
41     + {
42     + safe_touch "root/etc/e-smith/events/$event/templates2expand/$_";
43     + }
44     +}
45     +
46     +=head2 event_actions($event, %actions)
47     +
48     +Create links to actions for the given event. %actions is a list of pairs Action => Priority. E.g
49     +
50     + event_actions('myevent', 'action1' => '10', 'action2' => '20', ..);
51     +
52     +See also event_link().
53     +
54     +=cut
55     +
56     +sub event_actions
57     +{
58     + my ($event, %actions) = @_;
59     +
60     + foreach my $action (keys %actions)
61     + {
62     + my $level = $actions{$action};
63     + safe_symlink("../actions/${action}",
64     + "root/etc/e-smith/events/${event}/S${level}${action}");
65     + }
66     +}
67     +
68     +=head2 event_services($event, %services)
69     +
70     +Create links for the given $event in services2adjust/
71     +subdirectory. %services is a list of pairs Service =>
72     +LinkDestination
73     + event_services('myevent', 'sshd' => 'restart', 'samba' => 'reload')
74     +See also safe_symlink().
75     +
76     +=cut
77     +
78     +sub event_services
79     +{
80     + my ($event, %services) = @_;
81     +
82     + foreach my $service (keys %services)
83     + {
84     + my $action = $services{$service};
85     + safe_symlink($action, 'root/etc/e-smith/events/' . $event . '/services2adjust/' . $service);
86     + }
87     +}
88     +
89     +
90     =head1 AUTHOR
91    
92     SME Server Developers <bugs@e-smith.com>

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed