line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Cinnamon::DSL; |
2
|
2
|
|
|
2
|
|
9376
|
use strict; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
86
|
|
3
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
61
|
|
|
2
|
|
|
|
|
72
|
|
4
|
2
|
|
|
2
|
|
14
|
use parent qw(Exporter); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
19
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
112
|
use Cinnamon qw(CTX); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
113
|
|
7
|
2
|
|
|
2
|
|
939
|
use Cinnamon::Local; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
30
|
|
8
|
2
|
|
|
2
|
|
1140
|
use Cinnamon::Remote; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
27
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our @EXPORT = qw( |
11
|
|
|
|
|
|
|
set |
12
|
|
|
|
|
|
|
get |
13
|
|
|
|
|
|
|
role |
14
|
|
|
|
|
|
|
task |
15
|
|
|
|
|
|
|
call |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
remote |
18
|
|
|
|
|
|
|
run |
19
|
|
|
|
|
|
|
sudo |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub set ($$) { |
23
|
22
|
|
|
22
|
0
|
43
|
my ($name, $value) = @_; |
24
|
22
|
|
|
|
|
70
|
CTX->set_param($name => $value); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub get ($@) { |
28
|
11
|
|
|
11
|
0
|
23
|
my ($name, @args) = @_; |
29
|
11
|
|
|
|
|
33
|
CTX->get_param($name, @args); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub role ($$;$) { |
33
|
14
|
|
|
14
|
0
|
33
|
my ($name, $hosts, $params) = @_; |
34
|
14
|
|
|
|
|
41
|
CTX->add_role($name, $hosts, $params); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub task ($$) { |
38
|
23
|
|
|
23
|
0
|
42
|
my ($task, $task_def) = @_; |
39
|
23
|
|
|
|
|
69
|
CTX->add_task($task => $task_def); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub remote (&$) { |
43
|
1
|
|
|
1
|
0
|
3
|
my ($code, $host) = @_; |
44
|
|
|
|
|
|
|
|
45
|
1
|
|
|
|
|
5
|
my $remote = Cinnamon::Remote->new( |
46
|
|
|
|
|
|
|
host => $host, |
47
|
|
|
|
|
|
|
user => CTX->get_param('user'), |
48
|
|
|
|
|
|
|
); |
49
|
|
|
|
|
|
|
|
50
|
1
|
|
|
|
|
30
|
my $stash = CTX->stash; |
51
|
1
|
|
|
|
|
6
|
local $stash->{current_host} = $remote->host; |
52
|
1
|
|
|
|
|
2
|
local $stash->{current_remote} = $remote; |
53
|
|
|
|
|
|
|
|
54
|
1
|
|
|
|
|
3
|
$code->($host); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub call ($$) { |
58
|
0
|
|
|
0
|
0
|
0
|
my ($task_name, $host) = @_; |
59
|
0
|
|
|
|
|
0
|
CTX->call_task($task_name, $host); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub run (@) { |
63
|
3
|
|
|
3
|
0
|
7
|
my (@cmd) = @_; |
64
|
3
|
|
|
|
|
12
|
return CTX->run_cmd(\@cmd); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub sudo (@) { |
68
|
3
|
|
|
3
|
0
|
7
|
my (@cmd) = @_; |
69
|
3
|
|
|
|
|
7
|
return CTX->run_cmd(\@cmd, { sudo => 1 }); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
!!1; |