add keyname tag in ec2 listinstance

This commit is contained in:
Colin Gagnaire 2019-06-19 14:58:10 +02:00
parent c127ffcbb0
commit dd6f32f7bf
2 changed files with 5 additions and 3 deletions

View File

@ -348,6 +348,7 @@ sub ec2_list_resources {
InstanceType => $instance->{InstanceType},
State => $instance->{State}->{Name},
Tags => join(",", @instance_tags),
KeyName => $instance->{KeyName},
};
}

View File

@ -54,8 +54,8 @@ sub run {
$self->manage_selection(%options);
foreach (@{$self->{instances}}) {
next if ($_->{Type} !~ m/instance/);
$self->{output}->output_add(long_msg => sprintf("[Id = %s][AvailabilityZone = %s][InstanceType = %s][State = %s][Tags = %s]",
$_->{Name}, $_->{AvailabilityZone}, $_->{InstanceType}, $_->{State}, $_->{Tags}));
$self->{output}->output_add(long_msg => sprintf("[Id = %s][AvailabilityZone = %s][InstanceType = %s][State = %s][Tags = %s][KeyName = %s]",
$_->{Name}, $_->{AvailabilityZone}, $_->{InstanceType}, $_->{State}, $_->{Tags}, $_->{KeyName}));
}
$self->{output}->output_add(severity => 'OK',
@ -67,7 +67,7 @@ sub run {
sub disco_format {
my ($self, %options) = @_;
$self->{output}->add_disco_format(elements => ['id', 'availabilityzone', 'instancetype', 'state', 'tags']);
$self->{output}->add_disco_format(elements => ['id', 'availabilityzone', 'instancetype', 'state', 'tags', 'keyname']);
}
sub disco_show {
@ -82,6 +82,7 @@ sub disco_show {
instancetype => $_->{InstanceType},
state => $_->{State},
tags => $_->{Tags},
keyname => $_->{KeyName},
);
}
}