«
1
»
Rex 18 results
view release on metacpan or search on metacpan
ChangeLog view on Meta::CPAN
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
- Don't hardcode LibXML dependency - Jan Gehring
- workaround for wrong behaviour with -f and windows symlinks - Jan
Gehring
- it seems that the channel sometimes doesn't get closed in time. so w
+e
need an option to force close it after command run. - Jan Gehring
- fixed reporting for named resource - Jan Gehring
- pass cli parameters to tasks for pre 1.4 feature flags. fix #1039 -
+Jan
Gehring
- fixed old style Rex::Args->get when called from outside a task - Jan
Gehring
- Fix for #1054 - get_private_key() to check the private key file - Ta
+mas
Molnar
- Fix for #1052 - mask sudo_password in debug log - Tamas Molnar
- exit rex with an exitcode of 1 if some tests failed. fix #989 - Jan
Gehring
- show how to assign a user with a non-default shell - Andrew Solomon
- Fix example code (fix #1034) - Ferenc Erki
- Update example tasknames - Ferenc Erki
- Add possible root cause to authentication error message (fix #671) -
Ferenc Erki
- Correct message for authentication problems - Ferenc Erki
lib/Rex.pm view on Meta::CPAN
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
Use this function to create a connection if you use Rex as a library.
use Rex;
use Rex::Commands::Run;
use Rex::Commands::Fs;
Rex::connect(
server => "remotehost",
user => "root",
password => "f00b4r",
private_key => "/path/to/private/key/file",
public_key => "/path/to/public/key/file",
);
if(is_file("/foo/bar")) {
print "Do something...\n";
}
my $output = run("uptime");
=cut
lib/Rex/Box/Base.pm view on Meta::CPAN
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
my $that = shift;
my $proto = ref($that) || $that;
my $self = {@_};
bless( $self, $proto );
# default auth for rex boxes
$self->{__auth} = {
user => Rex::Config->get_user(),
password => Rex::Config->get_password(),
private_key => Rex::Config->get_private_key(),
public_key => Rex::Config->get_public_key(),
};
# for box this is needed, because we have changing ips
Rex::Config->set_openssh_opt(
StrictHostKeyChecking => "no",
UserKnownHostsFile => "/dev/null",
LogLevel => "QUIET"
);
lib/Rex/Commands/Cloud.pm view on Meta::CPAN
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
=cut
sub cloud_image_list {
return cloud_object()->list_images();
}
=head2 cloud_upload_key
Upload public SSH key to cloud provider
private_key '~/.ssh/mykey
public_key '~/.ssh/mykey.pub';
task "cloudprovider", sub {
cloud_upload_key;
cloud_instance create => {
...
};
};
lib/Rex/Commands/Rsync.pm view on Meta::CPAN
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
push @rsync_cmd, "--rsync-path='sudo rsync'";
}
$cmd = join( " ", @rsync_cmd );
my $pass = $auth->{password};
my @expect_options = ();
my $auth_type = $auth->{auth_type};
if ( $auth_type eq "try" ) {
if ( $server->get_private_key && -f $server->get_private_key ) {
$auth_type = "key";
}
else {
$auth_type = "pass";
}
}
if ( $auth_type eq "pass" ) {
$cmd = sprintf( $cmd,
"ssh -o StrictHostKeyChecking=no -o PubkeyAuthentication=no -p $po
+rt",
lib/Rex/Interface/Connection/OpenSSH.pm view on Meta::CPAN
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
bless( $self, $proto );
return $self;
}
sub connect {
my ( $self, %option ) = @_;
my (
$user, $pass, $private_key, $public_key, $server,
$port, $timeout, $auth_type, $is_sudo
);
$user = $option{user};
$pass = $option{password};
$server = $option{server};
$port = $option{port};
$timeout = $option{timeout};
$public_key = $option{public_key};
$private_key = $option{private_key};
$auth_type = $option{auth_type};
$is_sudo = $option{sudo};
$self->{server} = $server;
$self->{is_sudo} = $is_sudo;
$self->{__auth_info__} = \%option;
Rex::Logger::debug("Using Net::OpenSSH for connection");
Rex::Logger::debug( "Using user: " . $user );
Rex::Logger::debug( Rex::Logger::masq( "Using password: %s", $pass )
+ )
lib/Rex/TaskList/Base.pm view on Meta::CPAN
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
before_task_start => [],
name => $task_name,
executor => Rex::Interface::Executor->create,
connection_type => Rex::Config->get_connection_type,
);
if ( $self->{DEFAULT_AUTH} ) {
$task_hash{auth} = {
user => Rex::Config->get_user || undef,
password => Rex::Config->get_password || undef,
private_key => Rex::Config->get_private_key || undef,
public_key => Rex::Config->get_public_key || undef,
sudo_password => Rex::Config->get_sudo_password || undef,
};
}
if ( exists $Rex::Commands::auth_late{$task_name} ) {
$task_hash{auth} = $Rex::Commands::auth_late{$task_name};
}
$self->{tasks}->{$task_name} = Rex::Task->new(%task_hash);
t/0.31.t view on Meta::CPAN
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use warnings;
use Test::More tests => 139;
use Rex -feature => '0.31';
delete $ENV{REX_USER};
user("root3");
password("pass3");
private_key("priv.key3");
public_key("pub.key3");
key_auth();
no warnings;
is( Rex::TaskList->create()->is_default_auth(), 0, "default auth off"
+);
use warnings;
group( "foo", "server1", "server2", "server3" );
group( "bar", "serv[01..10]" );
t/group.t view on Meta::CPAN
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use warnings;
use Test::More tests => 95;
use Rex -feature => '0.31';
delete $ENV{REX_USER};
user("root3");
password("pass3");
private_key("priv.key3");
public_key("pub.key3");
no warnings;
$::FORCE_SERVER = "server1 foo[01..10]";
use warnings;
group( "forcetest1", "bla1", "blah2", "bla1" );
task( "tasktest3", "group", "forcetest1", sub { } );