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
Update copy image logic to match create image. #828
Conversation
/cc @supertom |
cc @tonybaloney |
Friendly ping? |
Sorry for the delay. Looks fine and tests/lint check pass. We've now duplicated that guest_os_feature check in both the create and copy methods - what do you think about creating a helper function to reduce the duplication (any chance of any other API exposing this somehow)? Also, are there more guest_os_features coming? Should we make a static list? |
I moved the functions together for that purpose and considered writing a helper function. I decided against it for two reasons.
We will want to add more guest_os_features in the near future, so it should be a static list. Any suggestions for where I should put that? Define a global variable in the file? |
Updated to make the feature a static list. |
Thanks for adding the list of OS features. I agree, the functions should be combined, but we can deal with that later on. LGTM. |
}, | ||
} | ||
|
||
if guest_os_features: |
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.
It looks like the same logic is duplicated in ex_create_image
method.
It would be great if it can be refactored in a shared utility method to avoid duplication and make maintenance easier.
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 agree - if you take a look at the conversation thread for the pull request, we discuss exactly that change.
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.
The TL;DR from the conversation was that the duplicated functionality I add will only be used by those two functions, so it doesn't make sense to move it into a helper. The two functions, however, should be combined since they do (essentially) the same thing. That should be done as a separate pull request. Do you have any other concerns before merging?
Any concerns about merging? |
Image "guestOsFeatures" should behave the same during image copy and creation.
Description
Status
done, ready for review
Checklist (tick everything that applies)