-
Notifications
You must be signed in to change notification settings - Fork 59
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
[provisioner] Add autoyast self update option #823
base: master
Are you sure you want to change the base?
Conversation
b3caa83
to
910de87
Compare
@@ -9,6 +9,8 @@ | |||
"access_keys": "", | |||
"shell_prompt": "USER@HOST:CWD SUFFIX", | |||
"enable_pxe": true, | |||
"self_update": false, | |||
"self_update_url": "http://updates.suse.com/sle12/$arch", |
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.
Shouldn't we default this to a repo that is mirrored on the admin server, like all the other repos we have there?
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.
Also, I'm not convinced we need a boolean to enable this or not. Either the repo is present locally (we enable), or the user provides an external URL (we enable), or the repo is not present locally and there's no url (we disable)
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.
@vuntz Thanks. I changed the PR.
910de87
to
05b21f5
Compare
@@ -26,6 +26,7 @@ | |||
<import_gpg_key config:type="boolean">true</import_gpg_key> | |||
</signature-handling> | |||
<storage/> | |||
<self_update_url><%= @self_update_url %></self_update_url> |
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.
Didn't we want to add some unless @self_update_url.nil? || @self_update_url.empty?
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.
done. Now, if the URL is empty AutoYaST will default to scc.suse.com if it's there.
@@ -9,6 +9,7 @@ | |||
"access_keys": "", | |||
"shell_prompt": "USER@HOST:CWD SUFFIX", | |||
"enable_pxe": true, | |||
"self_update_url": "http://crowbar/sle12/$arch", |
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 would change the default to: http://<ADMINWEB>/suse-12.2/$arch/repos/installer-update
(or something similar).
A couple of things:
<ADMINWEB>
should be substituted in the rails app (see glance & tempest barclamps)- if we put
suse-12.2
in the path, then maybe that attribute should live in a versioned suse attribute path somewhere (we already have that in the provisioner barclamp, I think) - we need a doc bug to document how to mirror that repo in the location
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've add the
<ADMINWEB>
alias. - Opened doc bug: https://bugzilla.suse.com/show_bug.cgi?id=1012469
- I reverted the default to "" which defaults to
scc.suse.com
. Or would you prefer a versioned local URL?
@@ -7,6 +7,9 @@ | |||
%span.help-block | |||
= t(".access_keys_hint") | |||
|
|||
= boolean_field :self_update |
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 one is gone :-)
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.
Good catch! I removed it.
05b21f5
to
8f70db2
Compare
@@ -333,6 +334,8 @@ def find_node_boot_mac_addresses(node, admin_data_net) | |||
web_port: web_port, | |||
packages: packages, | |||
repos: repos, | |||
self_update_url: node[:provisioner][:self_update_url].gsub( | |||
/<ADMINWEB>/, "#{admin_ip}:#{web_port}"), |
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.
Style/MultilineMethodCallBraceLayout: Closing method call brace must be on the line after the last argument when opening brace is on a separate line from the first argument.
8f70db2
to
df35e12
Compare
@@ -21,6 +21,7 @@ en: | |||
edit_attributes: | |||
access_keys: 'Additional SSH keys' | |||
access_keys_hint: 'Each SSH key must be on its own line' | |||
self_update_url: 'AutoYaST Self-update URL (The alias <ADMINWEB> can be used to specify the admin node)' |
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.
s/admin node/admin server/
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.
done
@@ -9,6 +9,7 @@ | |||
"access_keys": "", | |||
"shell_prompt": "USER@HOST:CWD SUFFIX", | |||
"enable_pxe": true, | |||
"self_update_url": "", |
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.
So we don't provide a default value that just works? :-)
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.
:) Well, the default in this case is to use scc.suse.com
which works. But we could also use a crowbar local default. Which would you prefer?
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 the default should be the mirror on the admin server.
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.
ok, done.
@@ -290,6 +290,7 @@ def find_node_boot_mac_addresses(node, admin_data_net) | |||
append << "ifcfg=dhcp4 netwait=60" | |||
append << "squash=0" # workaround bsc#962397 | |||
append << "autoupgrade=1" if mnode[:state] == "os-upgrading" | |||
append << "self_update" |
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.
Shouldn't we pass this only if self_update_url
is not empty?
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.
Also, if the URL contains <ADMINWEB>
, I think we could do some quick check with File.exists?
so that if we use a default with <ADMINWEB>
but the repo is not mirrored, we just don't enable the update feature.
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 added settings to autoyast.xml
so that failures in self update don't mean failure anymore. AutoYaST will log those failure but continue with the installation process.
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'll add a check whether the repository is actually there.
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 the check you mention here is still not there? :-)
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 added it now.
df35e12
to
011cbf1
Compare
return if all_nodes.empty? | ||
|
||
nodes = NodeObject.find("roles:provisioner-server") | ||
unless nodes.nil? or nodes.length < 1 |
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.
Style/AndOr: Use || instead of or. (https://github.com/bbatsov/ruby-style-guide#no-and-or-or)
Style/ZeroLengthPredicate: Use empty? instead of length < 1.
# "#{proposal["attributes"]["provisioner"]["self_update_url"]}" | ||
# )) | ||
# 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.
Style/LeadingCommentSpace: Missing space after #. (https://github.com/bbatsov/ruby-style-guide#hash-space)
@@ -50,6 +51,21 @@ def validate_proposal_after_save proposal | |||
end | |||
end | |||
|
|||
@logger.info("validating existence of #{proposal["attributes"]["provisioner"]["self_update_url"]}") | |||
|
|||
#if /<ADMINWEB>/ =~ proposal["attributes"]["provisioner"]["self_update_url"] |
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.
Style/LeadingCommentSpace: Missing space after #. (https://github.com/bbatsov/ruby-style-guide#hash-space)
@@ -50,6 +51,21 @@ def validate_proposal_after_save proposal | |||
end | |||
end | |||
|
|||
@logger.info("validating existence of #{proposal["attributes"]["provisioner"]["self_update_url"]}") |
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.
Metrics/LineLength: Line is too long. [103/100] (https://github.com/SUSE/style-guides/blob/master/Ruby.md#metricslinelength)
3e5c773
to
d719711
Compare
@vuntz Here is where I am at with this PR:
|
@nicolasbock Can you please change the prefix from |
@rsalevsky oop, sorry, of course. |
d719711
to
b9582db
Compare
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.
No commit message and no PR description => automatic -1 ;-p
b9582db
to
f3afca5
Compare
@aspiers I have added a description to the commit. Could you have another look? |
@@ -19,6 +19,7 @@ | |||
"access_keys": { "type": "str", "required": true }, | |||
"shell_prompt": { "type": "str", "required": true }, | |||
"enable_pxe": { "type": "bool", "required": true }, | |||
"self_update_url": { "type": "str", "required": true }, |
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.
Sorry, I failed to notice this earlier on, but we have a suse
attribute, and this should live in there. See line 56.
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.
Moved
@@ -290,6 +290,7 @@ def find_node_boot_mac_addresses(node, admin_data_net) | |||
append << "ifcfg=dhcp4 netwait=60" | |||
append << "squash=0" # workaround bsc#962397 | |||
append << "autoupgrade=1" if mnode[:state] == "os-upgrading" | |||
append << "self_update" |
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 the check you mention here is still not there? :-)
f3afca5
to
08ae4fc
Compare
do_self_update = node[:provisioner][:suse][:autoyast][:do_self_update] | ||
if do_self_update && ! expanded_self_update_url.empty? | ||
do_self_update = system("wget --quiet --spider #{expanded_self_update_url.gsub("$arch", "#{arch}")}") | ||
if ! do_self_update |
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.
Metrics/BlockNesting: Avoid more than 3 levels of block nesting. (https://github.com/bbatsov/ruby-style-guide#three-is-the-number-thou-shalt-count)
Style/NegatedIf: Favor unless over if for negative conditions. (https://github.com/bbatsov/ruby-style-guide#unless-for-negatives)
Style/SpaceAfterNot: Do not leave space between ! and its argument. (https://github.com/bbatsov/ruby-style-guide#no-space-bang)
) | ||
do_self_update = node[:provisioner][:suse][:autoyast][:do_self_update] | ||
if do_self_update && ! expanded_self_update_url.empty? | ||
do_self_update = system("wget --quiet --spider #{expanded_self_update_url.gsub("$arch", "#{arch}")}") |
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.
Style/UnneededInterpolation: Prefer to_s over string interpolation.
Metrics/LineLength: Line is too long. [109/100] (https://github.com/SUSE/style-guides/blob/master/Ruby.md#metricslinelength)
"<ADMINWEB>", "#{admin_ip}:#{web_port}" | ||
) | ||
do_self_update = node[:provisioner][:suse][:autoyast][:do_self_update] | ||
if do_self_update && ! expanded_self_update_url.empty? |
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.
Style/SpaceAfterNot: Do not leave space between ! and its argument. (https://github.com/bbatsov/ruby-style-guide#no-space-bang)
69174ee
to
e0eb5d2
Compare
if do_self_update && !expanded_self_update_url.empty? | ||
do_self_update = system("wget --quiet --spider " + | ||
"#{expanded_self_update_url.gsub("$arch", "#{arch}")}") | ||
unless do_self_update |
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.
Metrics/BlockNesting: Avoid more than 3 levels of block nesting. (https://github.com/bbatsov/ruby-style-guide#three-is-the-number-thou-shalt-count)
do_self_update = node[:provisioner][:suse][:autoyast][:do_self_update] | ||
if do_self_update && !expanded_self_update_url.empty? | ||
do_self_update = system("wget --quiet --spider " + | ||
"#{expanded_self_update_url.gsub("$arch", "#{arch}")}") |
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.
Style/UnneededInterpolation: Prefer to_s over string interpolation.
) | ||
do_self_update = node[:provisioner][:suse][:autoyast][:do_self_update] | ||
if do_self_update && !expanded_self_update_url.empty? | ||
do_self_update = system("wget --quiet --spider " + |
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.
Style/LineEndConcatenation: Use \ instead of + or << to concatenate those strings.
e0eb5d2
to
19d6255
Compare
do_self_update = node[:provisioner][:suse][:autoyast][:do_self_update] | ||
if do_self_update && !expanded_self_update_url.empty? | ||
do_self_update = system("wget --quiet --spider " \ | ||
expanded_self_update_url.gsub("$arch", "#{arch}")) |
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.
unexpected token tIDENTIFIER
unexpected token tRPAREN
19d6255
to
e045823
Compare
@aspiers I have added a commit message and a PR comment. |
@vuntz I think I have addressed the issues you raised. Could you have another look? |
AutoYaST can update itself before installing the OS. This patch enables this feature and adds a field to the provisioner barclamp so that a repository URL can be set by the user. The special token `<ADMINWEB>` resolves to the IP:port of the admin node. An empty URL defaults to the SUSE customer center (scc.suse.com).
e045823
to
ffaef28
Compare
@nicolasbock Removed my -1. I can't give +1 because I don't even understand why autoyast would need to self-update :-) If there's newer autoyast code then why wouldn't it be simply provided via TFTP/HTTP the first time around? |
@aspiers Thanks! Regarding your question: I haven't checked but am guessing that the autoyast comes from the image pulled from tftp on the admin node. I don't know though how and where from it is updated and I think your question is very valid 😄. I forgot to add this Trello card. |
@vuntz Could you have another look, please? |
AutoYaST can update itself before installing the OS. This patch enables
this feature and adds a field to the provisioner barclamp so that a
repository URL can be set by the user. The special token
<ADMINWEB>
resolvesto the IP:port of the admin node. An empty URL defaults to the SUSE
customer center (scc.suse.com).