From ee072f4bdf01051614775b457e1b2f898683e9c0 Mon Sep 17 00:00:00 2001 From: kcd83 Date: Tue, 5 Aug 2014 16:11:36 +1200 Subject: [PATCH] Ignore nil aws_reason for openstack ec2 Avoid NoMethodError: undefined method `sub' for nil:NilClass when no aws_reason is supplied by openstack implementation of ec2 --- lib/ec2/right_ec2_instances.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ec2/right_ec2_instances.rb b/lib/ec2/right_ec2_instances.rb index 6e3ecc4..b50cdaf 100644 --- a/lib/ec2/right_ec2_instances.rb +++ b/lib/ec2/right_ec2_instances.rb @@ -37,7 +37,7 @@ def get_desc_instances(instances) # :nodoc: reservation[:instances_set].each do |instance| # Parse and remove timestamp from the reason string. The timestamp is of # the request, not when EC2 took action, thus confusing & useless... - instance[:aws_reason] = instance[:aws_reason].sub(/\(\d[^)]*GMT\) */, '') + instance[:aws_reason] = instance[:aws_reason].sub(/\(\d[^)]*GMT\) */, '') unless instance[:aws_reason].nil? instance[:aws_owner] = reservation[:aws_owner] instance[:aws_reservation_id] = reservation[:aws_reservation_id] # Security Groups @@ -794,4 +794,4 @@ def reset end -end \ No newline at end of file +end