Rex-JobControl

 view release on metacpan or  search on metacpan

lib/Rex/JobControl/Helper/Project/Job.pm  view on Meta::CPAN

73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
  my $execute_path = "$job_path/execute/$job_id";
 
  my $logfile = "$execute_path/output.log";
 
  if ( !-f $logfile ) {
    $self->project->app->log->error(
      "This job doesn't have an output.log file.");
    return "No output.log found.";
  }
 
  my @loglines = eval { local ( @ARGV, $/ ) = ($logfile); <>; };
 
  return \@loglines;
}
 
sub create {
  my ( $self, %data ) = @_;
 
  my $job_path = File::Spec->catdir( $self->project->project_path,
    "jobs", $self->{directory} );

lib/Rex/JobControl/Helper/Project/Job.pm  view on Meta::CPAN

193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
  # execute strategt = node
  # execute all steps on a server, than continue
 
SERVER: for my $srv (@server) {
 
  STEP: for my $s ( @{ $self->steps } ) {
 
      if ( -f $self->project->project_path . "/next_server.txt" ) {
        $srv = eval {
          local ( @ARGV, $/ ) =
            ( $self->project->project_path . "/next_server.txt" );
          <>;
        };
        chomp $srv;
        unlink $self->project->project_path . "/next_server.txt";
      }
 
      my ( $rexfile_name, $task ) = split( /\//, $s );
      $rexfile_name = md5_hex($rexfile_name);
      my $rexfile = $self->project->get_rexfile($rexfile_name);

lib/Rex/JobControl/Mojolicious/Command/jobcontrol.pm  view on Meta::CPAN

144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
  }
 
  if ( $command eq "deluser" ) {
 
    my $user;
 
    GetOptionsFromArray \@args, 'u|user=s' => sub { $user = $_[1] };
 
    my @lines =
      grep { !m/^$user:/ }
      eval { local (@ARGV) = ( $self->app->config->{auth}->{passwd} ); <>; };
 
    open( my $fh, ">", $self->app->config->{auth}->{passwd} ) or die($!);
    print $fh join( "\n", @lines );
    close($fh);
  }
 
  if ( $command eq "listuser" ) {
    my @lines =
      eval { local (@ARGV) = ( $self->app->config->{auth}->{passwd} ); <>; };
    chomp @lines;
 
    for my $l (@lines) {
      my ( $user, $pass ) = split( /:/, $l );
      print "> $user\n";
    }
  }
 
}

lib/Rex/JobControl/Mojolicious/Plugin/User.pm  view on Meta::CPAN

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
 
sub register {
  my ( $plugin, $app ) = @_;
 
  $app->helper(
    get_user => sub {
      my ( $self, $uid ) = @_;
 
      my @lines =
        eval { local (@ARGV) = ( $self->app->config->{auth}->{passwd} ); <>; };
      chomp @lines;
 
      for my $l (@lines) {
        my ( $name, $pass ) = split( /:/, $l );
        if ( $name eq $uid ) {
          return { name => $name, password => $pass };
        }
      }
 
      return undef;



( run in 0.443 second using v1.01-cache-2.11-cpan-95122f20152 )