Rex
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/Rex/Box/Base.pm view on Meta::CPAN
#
# (c) Jan Gehring <jan.gehring@gmail.com>
#
=head1 NAME
Rex::Box::Base - Rex/Boxes Base Module
=head1 DESCRIPTION
This is a Rex/Boxes base module.
=head1 METHODS
These methods are shared across all other Rex::Box modules.
=cut
package Rex::Box::Base;
use v5.12.5;
use warnings;
our $VERSION = '1.14.3'; # VERSION
use Rex::Commands -no => [qw/auth/];
use Rex::Helper::Run;
use Rex::Commands::Fs;
use Rex::Commands::Virtualization;
use Rex::Commands::SimpleCheck;
use Rex::Helper::IP;
BEGIN {
LWP::UserAgent->use;
}
use Time::HiRes qw(tv_interval gettimeofday);
use File::Basename qw(basename);
use Data::Dumper;
sub new {
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"
);
return $self;
}
=head2 info
Returns a hashRef of vm information.
=cut
sub info {
my ($self) = @_;
return $self->{info};
}
=head2 name($vmname)
Sets the name of the virtual machine.
=cut
sub name {
my ( $self, $name ) = @_;
$self->{name} = $name;
}
=head2 setup(@tasks)
Sets the tasks that should be executed as soon as the VM is available through SSH.
=cut
=head2 storage('path/to/vm/disk')
Sets the disk path of the virtual machine. Works only on KVM
=cut
sub storage {
my ( $self, $folder ) = @_;
$self->{storage_path} = $folder;
}
sub setup {
my ( $self, @tasks ) = @_;
$self->{__tasks} = \@tasks;
}
=head2 import_vm()
view all matches for this distributionview release on metacpan - search on metacpan
( run in 0.556 second using v1.00-cache-2.02-grep-82fe00e-cpan-1925d2aa809 )