Subject: | The Perl class structure does not match EC2 API XML |
Date: | Thu, 14 Jan 2010 17:00:47 -0800 |
To: | bug-Net-Amazon-EC2 [...] rt.cpan.org |
From: | Vadim Geshel <vgeshel [...] gmail.com> |
The bug is in Net::Amazon::EC2 0.13
I was getting errors like:
Attribute (ebs) does not pass the type constraint because: Validation failed
for 'Maybe[Net::Amazon::EC2::EbsBlockDevice]' failed with value
Net::Amazon::EC2::EbsInstanceBlock\
DeviceMapping=HASH(0x2763128) at
/usr/local/share/perl/5.10.0/Net/Amazon/EC2.pm line 1600
Net::Amazon::EC2::describe_instances(undef) called at
/opt/yummly/ops/perl/lib/Yummly/EC2.pm line 37
Yummly::EC2::get_instance_for_host('Yummly::EC2=HASH(0x1b37cc0)',
'localhost') called at /opt/yummly/ops/perl/bin/postgres-backup.pl line 34
The following changes appear to fix the problem:
diff -c -r Net/Amazon/EC2/InstanceBlockDeviceMapping.pm
/usr/local/share/perl/5.10.0/Net/Amazon/EC2/InstanceBlockDeviceMapping.pm
*** Net/Amazon/EC2/InstanceBlockDeviceMapping.pm 2010-01-13
17:39:26.000000000 +0000
---
/usr/local/share/perl/5.10.0/Net/Amazon/EC2/InstanceBlockDeviceMapping.pm
2010-01-15
00:38:03.000000000 +0000
***************
*** 34,43 ****
=cut
! has 'volume_id' => ( is => 'ro', isa => 'Str', required => 1 );
! has 'status' => ( is => 'ro', isa => 'Str', required => 1 );
! has 'attach_time' => ( is => 'ro', isa => 'Str', required => 1 );
! has 'delete_on_termination' => ( is => 'ro', isa => 'Str', required => 1
);
__PACKAGE__->meta->make_immutable();
--- 34,41 ----
=cut
! has 'device_name' => ( is => 'ro', isa => 'Str', required => 1 );
! has 'ebs' => ( is => 'ro', isa =>
'Maybe[Net::Amazon::EC2::EbsInstanceBlockDeviceMapping]', required => 0 );
__PACKAGE__->meta->make_immutable();
***************
*** 53,56 ****
=cut
no Moose;
! 1;
\ No newline at end of file
--- 51,54 ----
=cut
no Moose;
! 1;
diff -c -r Net/Amazon/EC2/RunningInstances.pm
/usr/local/share/perl/5.10.0/Net/Amazon/EC2/RunningInstances.pm
*** Net/Amazon/EC2/RunningInstances.pm 2010-01-13 17:39:26.000000000 +0000
--- /usr/local/share/perl/5.10.0/Net/Amazon/EC2/RunningInstances.pm 2010-01-15
00:39:00.000000000 +0000
***************
*** 157,163 ****
has 'architecture' => ( is => 'ro', isa => 'Maybe[Str]', required => 0 );
has 'root_device_name' => ( is => 'ro', isa => 'Maybe[Str]', required => 0
);
has 'root_device_type' => ( is => 'ro', isa => 'Maybe[Str]', required => 0
);
! has 'block_device_mapping' => ( is => 'ro', isa =>
'Maybe[ArrayRef[Net::Amazon::EC2::BlockDeviceMapping]]', required => 0 );
__PACKAGE__->meta->make_immutable();
--- 157,163 ----
has 'architecture' => ( is => 'ro', isa => 'Maybe[Str]', required => 0 );
has 'root_device_name' => ( is => 'ro', isa => 'Maybe[Str]', required => 0
);
has 'root_device_type' => ( is => 'ro', isa => 'Maybe[Str]', required => 0
);
! has 'block_device_mapping' => ( is => 'ro', isa =>
'Maybe[ArrayRef[Net::Amazon::EC2::InstanceBlockDeviceMapping]]', required =>
0 );
__PACKAGE__->meta->make_immutable();
Only in /usr/local/share/perl/5.10.0/Net/Amazon/EC2:
TerminateInstancesResponse.pm
diff -c -r Net/Amazon/EC2.pm /usr/local/share/perl/5.10.0/Net/Amazon/EC2.pm
*** Net/Amazon/EC2.pm 2010-01-13 17:39:26.000000000 +0000
--- /usr/local/share/perl/5.10.0/Net/Amazon/EC2.pm 2010-01-15
00:54:34.000000000 +0000
***************
*** 1597,1603 ****
delete_on_termination => $bdm->{ebs}{deleteOnTermination},
);
! my $block_device_mapping = Net::Amazon::EC2::BlockDeviceMapping->new(
ebs => $ebs_block_device_mapping,
device_name => $bdm->{deviceName},
);
--- 1597,1603 ----
delete_on_termination => $bdm->{ebs}{deleteOnTermination},
);
! my $block_device_mapping =
Net::Amazon::EC2::InstanceBlockDeviceMapping->new(
ebs => $ebs_block_device_mapping,
device_name => $bdm->{deviceName},
);
***************
*** 3858,3861 ****
=head1 SEE ALSO
! Amazon EC2 API: L<
http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/>
\ No newline at end of file
--- 3858,3861 ----
=head1 SEE ALSO
! Amazon EC2 API: L<
http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/>