Rex

 view release on metacpan or  search on metacpan

ChangeLog  view on Meta::CPAN

 - 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 we
   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 - Tamas
   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

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

  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

=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

  }

  $cmd = join( " ", @rsync_cmd );

  if ( !$local_connection ) {
    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 $port",

lib/Rex/Interface/Connection/OpenSSH.pm  view on Meta::CPAN


  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

    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

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

use Test::More tests => 97;

use Rex -feature => '0.31';
use Rex::Group;
use Symbol;

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 { } );

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.540 second using v1.00-cache-1.14-grep--cpan-9b3982acd67 )