-
Notifications
You must be signed in to change notification settings - Fork 982
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
Fixes #746 - Generate all the Host template when click on Build to avoid... #1753
Conversation
@@ -786,6 +787,46 @@ def validate_media? | |||
managed && pxe_build? && build? | |||
end | |||
|
|||
def template_used(provisioning = nil) | |||
kinds = if provisioning == 'image' |
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.
Please refactor into a separate method available_template_kinds
or something like that.
@shlomizadok There is some test that needs to be fixed and also the stuff I commented about. |
@elobato Thanks for the review. I will fix your comments and fix the tests. I am also extending the 'review before build' to: a) return a better explanation of what failed (as you have also commented) and b) to test if the smart proxy is available before building. |
@@ -350,3 +350,7 @@ table.table thead .sorting_desc_disabled { background: #f9f9f9 url('sort_desc_di | |||
.config_group, .selected_config_group { | |||
min-height: 30px; | |||
} | |||
|
|||
#fakepasswordremembered { | |||
display: none; |
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.
please extracte to a different PR
4e57c4f
to
18a3e22
Compare
@@ -93,4 +93,4 @@ def unattended_render_to_temp_file content, prefix = id.to_s, options = {} | |||
end | |||
|
|||
end | |||
end | |||
end |
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.
Nitpick: No newline :-D
Nice, I like that a lot. Do folks think it is good time to add the rendered templates to audit now? Or would it make sense to add all template rendering to audit in more generic way? |
30d9135
to
844d9e9
Compare
@@ -187,10 +188,26 @@ def puppetrun | |||
redirect_to host_path(@host) | |||
end | |||
|
|||
def review_before_build | |||
@build = HostBuildStatus.new(@host).host_build_status |
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.
you can avoid returning self if you change this line to
(@build = HostBuildStatus.new(@host)).host_build_status
another simple way, is to add a method on the host object similar to
def build_status
build_status = HostBuildStatus.new(self)
build_status.host_build_status # I would rename to method but thats another story
build_status
end
16fd768
to
ba1093e
Compare
build_status.check_all_statuses | ||
build_status | ||
end | ||
|
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.
why in host common? I don't think it is used in hostgroup?
tested (without a Compute Resource), works for me.
|
27f9095
to
bfa1967
Compare
@mmoll - Thanks for testing. I have fixed the error message (though error handling on smart_proxy api should be re-factored too [but that is for another pr]) |
def supports_power_and_running(host) | ||
return false unless host.compute_resource_id || host.bmc_available? | ||
host.power.ready? | ||
rescue ProxyAPI::ProxyException |
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.
add an explanation ?
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.
Don't think so. Should return true or false. The rescue is in cases the Proxy is unavailable.
$('#review_before_build').on('click', "#recheck_review", function () { | ||
$("#build-review").click(); | ||
}); | ||
}); |
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.
a tidy bit more optimized jquery could be:
$(function () {
- $("#build-review").click(function() {
- $("#review_before_build .modal-body #build_status").html('');
+ var dialog = $("#review_before_build");
+ $("#build-review").click(function () {
+ dialog.find(".modal-body #build_status").html('');
$('.loading').addClass('visible');
$.ajax({
- type:'get',
+ type: 'get',
url: $(this).attr('data-url'),
- success: function(result){
- $("#review_before_build .modal-body #build_status").html(result);
+ success: function (result) {
+ $("#review_before_build").find(".modal-body #build_status").html(result);
},
- complete: function(){
+ complete: function () {
$('.loading').removeClass('visible');
}
- })
+ });
});
- $('#review_before_build').on('change', "#host_build", function () {
+ dialog.on('change', "#host_build", function () {
$('#build_form').find('input.submit').val((this.checked) ? (__("Reboot and build")) : (__("Build")));
});
- $('#review_before_build').on('click', "#recheck_review", function () {
+ dialog.on('click', "#recheck_review", function () {
$("#build-review").click();
});
});
@ohadlevy tidied the js, rebased and tests are 💚 |
…uild to avoid errors during installation
merged as 6e916e5 thanks @shlomizadok! |
Generate all the Host template when click on Build to avoid errors during installation.
Includes moving of template_used to Managed model so it can be used elsewhere.