Changeset 1679 in ProjectBuilder for projects/casparbuster/devel/lib/CasparBuster/Plugin.pm
- Timestamp:
- Nov 16, 2012, 9:07:07 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
projects/casparbuster/devel/lib/CasparBuster/Plugin.pm
r1494 r1679 9 9 use strict; 10 10 use warnings; 11 use Carp; 11 12 use CasparBuster::Env; 12 13 use ProjectBuilder::Base; … … 76 77 my $plugin = shift; 77 78 my $cbp = shift; 79 my $remote = shift; 80 my $machine = shift; 81 my $debug = shift; 82 my $ssh2 = shift; 78 83 79 84 pb_log(2,"Entering cb_plugin_get for plugin $plugin\n"); 80 my ($flist,$dlist,$dflist,$slist ) = pb_conf_get_if("cbpluginfiles","cbplugindirs","cbplugindirsandfiles","cbpluginreload");85 my ($flist,$dlist,$dflist,$slist,$plist) = pb_conf_get_if("cbpluginfiles","cbplugindirs","cbplugindirsandfiles","cbppkgreload","cbpluginpkgs"); 81 86 if ((defined $flist) && (defined $flist->{$plugin}) && ($flist->{$plugin} !~ /^\s*$/)) { 82 87 foreach my $block (split(/;/,$flist->{$plugin})) { … … 100 105 } 101 106 } 102 if ((defined $slist) && (defined $slist->{$plugin})) { 103 $cbp->{$plugin}->{'reloadscript'} = $slist->{$plugin}; 107 if ((defined $plist) && (defined $plist->{$plugin})) { 108 foreach my $name (split(/,/,$plist->{$plugin})) { 109 $cbp->{$plugin}->{'pkgs'}->{$name}->{'name'} = $name; 110 if ((defined $slist) && (defined $slist->{$name})) { 111 $cbp->{$plugin}->{'pkgs'}->{$name}->{'restart'} = $slist->{$name}; 112 } 113 } 114 } else { 115 $cbp->{$plugin}->{'pkgs'}->{$plugin}->{'name'} = $plugin; 104 116 } 117 # Check remotely what conf files are needed for this plugin through its packages 118 $ssh2 = cb_ssh_init($remote,$machine,$debug) if (not defined $ssh2); 119 120 my $chan = $ssh2->channel(); 121 pb_log(3,"DEBUG: SSH2 chan called\n"); 122 confess "Unable to create channel for $remote\@$machine: $!" if (not defined $chan); 123 if ($debug) { 124 pb_log(1,"DEBUG: launching a shell via Net:SSH2 ($remote\@$machine)\n"); 125 } 126 confess "Unable to launch remote shell through Net:SSH2 ($remote\@$machine)" if (not $chan->shell()); 127 pb_log(3,"DEBUG: SSH2 shell called\n"); 128 129 foreach my $p (keys $cbp->{$plugin}->{'pkgs'}) { 130 # TODO: Do not hardcode rpm 131 my $cmd = "sudo rpm -q -c --dump $p"; 132 pb_log(2,"DEBUG: Calling $cmd\n"); 133 print $chan "$cmd\n"; 134 while (<$chan>) { 135 my ($name,$d1,$d2,$d3,$mode,$uid,$gid,$dummy) = split(/ /,$_); 136 $cbp->{$plugin}->{'files'}->{$name}->{'uid'} = $uid; 137 $cbp->{$plugin}->{'files'}->{$name}->{'gid'} = $gid; 138 $cbp->{$plugin}->{'files'}->{$name}->{'mode'} = substr($mode,4,); 139 pb_log(3,"DEBUG: Found $name"); 140 } 141 } 142 143 $chan->close(); 144 105 145 pb_log(2,"cbp: ".Dumper($cbp)."\n"); 106 146 return($cbp);
Note:
See TracChangeset
for help on using the changeset viewer.