-
Notifications
You must be signed in to change notification settings - Fork 70
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 logic for cloud-init and variable names for resolving ambiguity #1636
update logic for cloud-init and variable names for resolving ambiguity #1636
Conversation
6191483
to
b6c7e13
Compare
|
||
- name: "check cloud_config is used or not" | ||
set_fact: | ||
cloud_config_used: "{{ true if (cloud_config['users'] == [] and cloud_config['run_commands'] == []) else false }}" | ||
cloud_init_used: "{{ true if (cloud_config['users'] != [] and cloud_config['run_commands'] == []) else false }}" |
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.
This line still looks wrong to me. Shouldn't you correct the check on run_commands and is and still the correct logic? Wouldn't it be correct if either you had users or run_commands defined?
Has this passed your unit tests for cloud-init??
Why change the variable name when it has nothing to do with the logic fix? it makes a one line patch much bigger than it needs to.
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.
@p3ck
There are two ways to one can use cloud_config in linchpin
cloud_config variable that contains virt-type as one of the parameters that determine whether we use cloud-init or virt-customize. It defaults to cloud-init.
when using cloud-init does not have an option for run_commands since it is provided by virt-customize.
the above condition checks if run_commands empty or not.
Thinking of the above maybe we should check if run_commands parameter is defined or not.
I am afraid we do not have any unit tests for cloud-init but I tested it with libvirt-custom-xml target
from the libvirt workspace.
cloud_config_used variable is used to only check for the case when is cloud-init is used.
That's the reason I renamed cloud_config used to cloud_init used.
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 logic seems to work, but there may be a more elegant way of solving the issue. In order to determine if you run cloud-init or virt-customize, do you just check whether run_commands
exists?
I do see SK's point about changing the variable name. It makes the PR longer but definitely makes the code easier to understand
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 am afraid we do not have any unit tests for cloud-init but I tested it with libvirt-custom-xml target
from the libvirt workspace." <- Is adding unit tests for it and CI testing for libvirt overall on the near term roadmap? I know of at least three teams that rely on libvirt in linchpin working and this latest release bit us
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.
@johnbieren We will try to re-enable to ci for libvirt on one distro,
however, I am not sure how easy or difficult the task would be we faced multiple (networking) problems with libvirt provisioning with existing ci. Which made us disable libvirt testing.
I am currently, working on #1542 for libvirt that simulates one of the scenarios of libvirt.
provisioning which might help partially with testing.
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 I don't follow. I have been using libvirt from linchpin for over a year now in my projects and with each linchpin release it either works exactly as I expect or doesn't work at all. There are no inconsistencies. What networking problems come up? I have not hit any networking problems ever using linchpin when I am on a working release
It's no wonder I'm confused. Looking at the code there is virt_type which can be virt-customize or cloud-init, but then there is more logic in the latest version with cloud_config_used which is now called cloud_init_used. |
No, this patch does not work |
|
b6c7e13
to
c1bcb10
Compare
ssh now works with the latest version of the patch |
@samvarankashyap Can you rebase this against the latest version of develop? |
c1bcb10
to
a2baa69
Compare
@14rcole rebased |
[test] |
a2baa69
to
2c68e1e
Compare
[merge] |
$subject
#1630
@johnbieren Please check if this patch works for you.