-
-
Notifications
You must be signed in to change notification settings - Fork 352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix VPC parser #389
Fix VPC parser #389
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looking good, just added some minor feedback. Thanks!
lib/fog/aws/models/compute/vpc.rb
Outdated
|
||
attribute :cidr_block_association_set, :aliases => 'cidrBlockAssociationSet' | ||
|
||
attribute :ipv_6_cidr_block_association_set, :aliases => 'ipv6CidrBlockAssociationSet' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it was already there, but it seems surprising to me that this is ipv_6_cidr_block_association_set
instead of ipv6_cidr_block_association_set
. Does that make sense? I just happened to notice here (and have the same question about the new attribute below). What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you are right. We could just add alias for backward compatibility (ipv_6_cidr_block_association_set is already released...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hadn't even thought about that, but that sounds good. That way we can have more consistent names, but avoid breaking anybody. Sound good?
@current_cidr_block[name] = value | ||
|
||
when 'vpcSet.item.cidrBlockAssociationSet.item.cidrBlockState' | ||
@current_cidr_block['state'] = value.squish |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the old version state
was capitalized as State
, not sure it makes that much difference, but probably better safe than sorry. Could you change it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like the inconsistency:
{
"cidrBlock" => "...",
"associationId" => "...",
"State" => "associated"
}
Can we sacrifice backward compatibility in that case (knowing that ipv_6_cidr_block_association_set
support just released)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't feel super strongly about it, so I'm alright leaving it as you suggest. I just wanted to at least discuss it, which we now have. Thanks!
@current_ipv6_block[name] = value | ||
|
||
when 'vpcSet.item.ipv6CidrBlockAssociationSet.item.ipv6CidrBlockState' | ||
@current_ipv6_block['state'] = value.squish |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing here, if we could keep it as State
for safety that would be great.
@lanej This looks good to me other than my feedback, but I would appreciate an extra set of eyes if you have a chance. Thanks! |
Seeing some failure when doing live testing
String#squish is an rails-ism that we do not have access to. |
I'm fine with this going in and adding the aliases later too, if that is easier. |
A @ddiachkov please rebase this PR and resolve conflicts, when you're ready. |
f8aa51b
to
3a44e60
Compare
@lanej done |
Live tests result:
Beyond that, I think this is ready to go. |
@geemus I am still getting |
@lanej thats not right... Which field contains |
@ddiachkov seems the |
Let me check it on a real AWS |
f8aa51b
to
a4fe5de
Compare
Hey @lanej, are you sure you use this branch? [{"tagSet"=>{},
"cidrBlockAssociationSet"=>
[{"cidrBlock"=>"10.255.254.0/28",
"associationId"=>"vpc-cidr-assoc-687a8b02",
"state"=>"associated"}],
"ipv6CidrBlockAssociationSet"=>[],
"vpcId"=>"vpc-cab34db2",
"state"=>"available",
"cidrBlock"=>"10.255.254.0/28",
"dhcpOptionsId"=>"dopt-2873c74c",
"instanceTenancy"=>"default",
"isDefault"=>false},
{"tagSet"=>{},
"cidrBlockAssociationSet"=>
[{"cidrBlock"=>"172.31.0.0/16",
"associationId"=>"vpc-cidr-assoc-473c8e2e",
"state"=>"associated"}],
"ipv6CidrBlockAssociationSet"=>[],
"vpcId"=>"vpc-3e9d1659",
"state"=>"available",
"cidrBlock"=>"172.31.0.0/16",
"dhcpOptionsId"=>"dopt-2873c74c",
"instanceTenancy"=>"default",
"isDefault"=>true},
{"tagSet"=>{},
"cidrBlockAssociationSet"=>
[{"cidrBlock"=>"10.255.254.0/28",
"associationId"=>"vpc-cidr-assoc-c17988ab",
"state"=>"associated"}],
"ipv6CidrBlockAssociationSet"=>[],
"vpcId"=>"vpc-5cb04e24",
"state"=>"available",
"cidrBlock"=>"10.255.254.0/28",
"dhcpOptionsId"=>"dopt-2873c74c",
"instanceTenancy"=>"default",
"isDefault"=>false}],
"requestId"=>"920616e6-36fd-4779-9c41-21f0518aa52c"} Thats what I get on a real AWS. Notice that ipv_6_cidr_block_association_set is an Array, not Hash. |
I've added additional format tests. |
Thanks @ddiachkov. Hey @geemus, how would you feel about moving the |
@lanej feel free to do that if you think it makes sense (though presumably we'll want to also fix that before release?). |
@ddiachkov sorry for the delay. If you rebase off master, we can get this out. |
dd1de0b
to
915e069
Compare
No worries. I've rebased the code – looks like tests are passed. |
@geemus has your feedback been addressed? |
@lanej I think so, thanks for double checking! |
@ddiachkov thanks! |
This PR fixes problems with VPC parser + adds
cidr_block_association_set
attribute to model.#379 was not sufficient – VPC list still contains duplicates with invalid status.
NB:
cidr_block_association_set
andipv_6_cidr_block_association_set
are array of hashes (currentlyipv_6_cidr_block_association_set
is a Hash)