Rex-JobControl
view release on metacpan or search on metacpan
lib/Rex/JobControl/Helper/Project/Job.pm view on Meta::CPAN
7374757677787980818283848586878889909192
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
193194195196197198199200201202203204205206207208209210211212213
# 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
144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
}
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
($!);
$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
);
"> $user\n"
;
}
}
}
lib/Rex/JobControl/Mojolicious/Plugin/User.pm view on Meta::CPAN
161718192021222324252627282930313233343536sub
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 )