App-Shotgun

 view release on metacpan or  search on metacpan

lib/App/Shotgun/Target/SFTP.pm  view on Meta::CPAN

has sftp => (
	isa => 'Maybe[POE::Component::Generic]',
	is => 'rw',
	init_arg => undef,
);

# the master told us to shutdown
event shutdown => sub {
	my $self = shift;

	# remove the timeout timer
	$poe_kernel->delay( 'timeout_event' );

	# tell poco-generic to shutdown
	if ( defined $self->sftp ) {
		# TODO ARGH poco-generic NEEDS TO SHUTDOWN NOW
		# the problem is that it does a "graceful" shutdown
		# but the ssh process is stuck on password prompt
		# and everything freezes....
		$self->sftp->{'wheel'}->kill( 'KILL' );
		$poe_kernel->call( $self->sftp->session_id, 'shutdown' );

lib/App/Shotgun/Target/SFTP.pm  view on Meta::CPAN


			user => $self->username,
			( $self->_has_password ? ( password => $self->password ) : () ),

			timeout => 120,
		],

#		( 'debug' => 1, 'error' => 'sftp_generic_error' ),
	) );

	# set a timer in case the password negotiation/whatever doesnt work
	$poe_kernel->delay( 'timeout_event' => 120 );

	# check for connection error
	$self->sftp->error( { 'event' => 'sftp_connect' } );

	return;
}

event timeout_event => sub {
	my $self = shift;

lib/App/Shotgun/Target/SFTP.pm  view on Meta::CPAN


	# TODO some optimizations to make compatibility better?
#		copy_time => 0,
#		copy_perm => 0,
#		perm => 0755,
}

event sftp_connect => sub {
	my( $self, $response ) = @_;

	# remove the timeout timer
	$poe_kernel->delay( 'timeout_event' );

	# TODO poco-generic sucks for not properly shutting down
	return if ! defined $self->sftp;

	# Did we get an error?
	if ( ! $response->{'result'}[0] ) {
		# set our cwd so we can initiate the transfer
		$self->sftp->setcwd( { 'event' => 'sftp_setcwd', 'data' => $self->path->stringify }, $self->path->stringify );
	} else {



( run in 0.629 second using v1.01-cache-2.11-cpan-49f99fa48dc )