Closed (fixed)
Project:
Cloud
Version:
3.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
7 Aug 2020 at 06:56 UTC
Updated:
27 Aug 2020 at 00:14 UTC
Jump to comment: Most recent, Most recent file
| Comment | File | Size | Author |
|---|---|---|---|
| #18 | 3163932-18.patch | 50.09 KB | jigish.addweb |
Comments
Comment #2
jigish.addweb commentedComment #3
jigish.addweb commentedComment #4
yasIs there any reason why you didn't use
$updated === TRUEhere?Can you refactor to aggregate those
updateAll*List()methods to e.g.updateAllResourceList()?Can you refactor the logic in the method to even simpler? (Reducing or aggregating
if-statement)Do we need the parameter $cloud_context? Because this is CloudConfig entity, so it should hold the $cloud_context inside the instance. (Can we use
getCloudContext()ingetResourceLink()?)Comment #5
jigish.addweb commentedComment #6
jigish.addweb commented@yas
Thank you for your review.
1. There was a condition for FALSE (i.e.
$updated !== FALSE) so that I had followed that code but now, I have changed it to$updated === TRUE.2. Refactored the code of
updateAll*List()methods and added common methodupdateAllResourceList().3. Reduced if-statements as much as possible.
4. Removed
$cloud_contextparameter and usedgetCloudContext()instead of$cloud_context.Please review updated patch.
Thanks
Comment #7
yas@jigishaddweb
Thank you for the update.
Can we refactor as follows?
FROM:
TO:
Comment #8
jigish.addweb commentedComment #9
jigish.addweb commented@yas
I have done changes as per your comment. Please review updated patch.
Thanks
Comment #10
jigish.addweb commented@yas
I have added permission to each AWS entity. Please review this updated patch.
Thanks
Comment #11
yas@jigishaddweb
Thank you for the update.
Let's reduce the if-statement nest and adding
!empty():FROM:
TO:
@xiaohua-guan, @baldwinloue
What do you think in the other portion?
Comment #12
jigish.addweb commentedComment #13
jigish.addweb commented@yas
I did changes as per your comment. Please review the new patch.
Thanks
Comment #14
baldwinlouie commented@jigishaddweb, Thank you for the updated patch. I have the following comments.
clearCacheValue()can potentially be called twice per API operation. Once inside theupdate*List()and once inside theupdateEntityMessagemethod.Please choose one place to call the cache clear.
I think it should be in the
APIControllercode and not insideupdateEntityMessage.updateEntityMessageshould only be for setting messages.When an Elastic Ip is updated, there is code that updates the NetworkInterfaces as well. This code needs to be moved to
updateAllResourceListas well.Please initialize
$account_idto something. There is a chance $account_id can be returned uninitialized.If this is a public method, please put this in
ApiControllerInterface. If it is only meant to be a helper method, please make this private.This method should also catch the following exceptions:
Since we have to support a custom case for aws_elastic_ips, how about we use a "switch" statement, where the default case is the code inside
if ($entity_type_name !== 'aws_cloud_image)?We can then have switch cases for 'aws_cloud_image' and 'aws_cloud_elastic_ips'..etc...
If this is a public method, please add a definition in
CloudConfigInterfaceComment #15
jigish.addweb commentedComment #16
jigish.addweb commented@baldwinlouie
Thank you for reviewing the patch.
1.
Ec2Service::clearCacheValue();is used forupdate*List()not forupdateAll*List()method.$this->clearCacheValue();is used forupdateAll*List()so both are using for different methods.I moved
$this->clearCacheValue();intoupdateAllResourceList()instead ofupdateEntityMessage().2. Moved Elastic Ip logic into
updateAllResourceList()with status messages fromupdateEntityMessage().3. I initialized
$account_idto NULL.4. We can not declare it as private as it is used in
ApiController. I addedupdateAllResourceList()inEc2ServiceInterface.5. Converted the logic into switch case.
6. Added
getResourceLink()inCloudConfigInterface.Please review the updated patch.
Thanks
Comment #17
baldwinlouie commented@jigishaddweb, thank you for the updated patch. Please see my comments below.
I think it is better to catch the exceptions in the method and display an error message.
The methods that call
updateallResourceListdo not catch the exceptions. Thus, there is a chance we get a White Screen due to a 500 error.I think you can get rid of
$account = $this->currentUser()and useSince we are not using
$accountagain.Comment #18
jigish.addweb commentedComment #19
jigish.addweb commented@baldwinlouie
I did changes as per your comment. Please review the new patch.
Thanks
Comment #20
baldwinlouie commented@jigishaddweb, thank you for the patch. It looks good now!
Comment #21
yas@baldwinlouie
Thank you for your review. I'll merge the patch to
8.x-1.x,8.x-2.xand3.xand close this issue asFixed.Comment #25
yas