Changeset 411


Ignore:
Timestamp:
11/16/11 00:29:53 (12 years ago)
Author:
nanardon
Message:
  • use a config file for sophie_notify
  • fix login
  • kill warn()
Location:
tools/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • tools/trunk/bin/sophie-rpm2

    r405 r411  
    1616    'l=s' => \my $login, 
    1717    'p=s' => \my $pass, 
    18     't=s' => \my $type, 
    1918    'd=s' => \my @options, 
    2019    'proxy' => \my $proxy, 
     
    4342    login => $login, 
    4443    password => $pass, 
    45     type => $type, 
    4644    proxy => $proxy, 
    4745); 
  • tools/trunk/bin/sophie_notify

    r410 r411  
    77use Getopt::Long; 
    88use Sophie::Client; 
     9use Config::General; 
    910 
    1011$ENV{LC_ALL} = 'C'; 
    1112 
    1213GetOptions( 
    13     'bdelay=i' =>  \my $updated_inotify, 
     14    'c=s'      => \my $configfile, 
     15    'bdelay=i' => \my $updated_inotify, 
    1416    'd|daemon' => \my $daemon, 
    1517    'u|url=s'  => \my $server, 
     18    'l=s'      => \my $login, 
     19    'p=s'      => \my $pass, 
     20    'proxy=s'  => \my $proxy, 
    1621) or die "Wrong options"; 
     22 
     23$configfile ||= '/etc/sophie/sophie-notify.conf'; 
     24 
     25if (-f $configfile && (my $conf = Config::General->new($configfile))) { 
     26    my %config = $conf->getall; 
     27    $server      ||= $config{url}; 
     28    $login       ||= $config{login}; 
     29    $pass        ||= $config{pass}; 
     30    $proxy       ||= $config{proxy}; 
     31} 
    1732 
    1833$updated_inotify ||= 500; 
     
    2540 
    2641my $sc = Sophie::Client->new( 
    27     server => $server, 
     42    server     => $server, 
     43    login      => $login, 
     44    password   => $pass, 
     45    proxy      => $proxy, 
    2846); 
    2947 
     
    4765        $update = 0; 
    4866    } 
    49     warn "$$ Inotify"; 
    5067    if ($inotify) { 
    5168        $inotify->poll; 
     
    6683        %modified_paths = (); 
    6784    } else { 
    68         warn "XML RPC error"; 
     85        #warn "XML RPC error"; 
    6986    } 
    7087} 
     
    7693        @paths = grep { -d $_ } map { $_->{path} } @{ $res->value }; 
    7794    } else { 
    78         warn "XML RPC error"; 
     95        #warn "XML RPC error"; 
    7996    } 
    8097} 
     
    8299 
    83100sub inotify_path { 
    84     warn "inotify_path"; 
    85101    my $i = Linux::Inotify2->new; 
    86102    my $sub = sub { 
    87103        my $e = shift; 
    88         warn $e->w->name; 
    89  
    90104        $modified_paths{$e->w->name} = 1; 
    91105        notify_base(); 
  • tools/trunk/lib/Sophie/Client.pm

    r410 r411  
    4040            $options{login}, 
    4141            $options{password}); 
    42         if (ref $res) { 
     42        if (ref $res && !$res->is_fault) { 
    4343            $self->request->header('cookie', $$res); 
    4444            return 1; 
Note: See TracChangeset for help on using the changeset viewer.