- # skip existing scrips
- next if ( exists($scrip{$c}{$a}{$t}) );
- if ( !exists($condition{$c}) ) {
- warn "ScripCondition '$c' not found.\n";
- next;
- }
- if ( !exists($action{$a}) ) {
- warn "ScripAction '$a' not found.\n";
- next;
- }
- if ( !exists($template{$t}) ) {
- warn "Template '$t' not found.\n";
- next;
+
+ if ( exists($scrip{$c}{$a}) ) {
+ $Scrip->Load( $scrip{$c}{$a} );
+ } else { # need to create it
+
+ if ( !exists($condition{$c}) ) {
+ warn "ScripCondition '$c' not found.\n";
+ next;
+ }
+ if ( !exists($action{$a}) ) {
+ warn "ScripAction '$a' not found.\n";
+ next;
+ }
+ if ( !exists($template{$t}) ) {
+ warn "Template '$t' not found.\n";
+ next;
+ }
+ my %new_param = (
+ ScripCondition => $condition{$c}->[0],
+ ScripAction => $action{$a}->[0],
+ Template => $template{$t}->[0],
+ Queue => 0,
+ Description => $desc,
+ );
+ warn "Creating scrip: $c $a [$t]\n";
+ my ($val, $msg) = $Scrip->Create(%new_param);
+ die $msg if !$val;
+
+ } #if $scrip{...}
+ # set the Immutable attribute on them if needed
+ if ( !$Scrip->FirstAttribute('Immutable') ) {
+ my ($val, $msg) =
+ $Scrip->SetAttribute(Name => 'Immutable', Content => '1');
+ die $msg if !$val;