[provisioner] Add autoyast self update option#823
[provisioner] Add autoyast self update option#823nicolasbock wants to merge 1 commit intocrowbar:masterfrom
Conversation
b3caa83 to
910de87
Compare
| "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.
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.
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)
910de87 to
05b21f5
Compare
| <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.
Didn't we want to add some unless @self_update_url.nil? || @self_update_url.empty?
There was a problem hiding this comment.
done. Now, if the URL is empty AutoYaST will default to scc.suse.com if it's there.
| "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.
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.2in 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.
- 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?
| %span.help-block | ||
| = t(".access_keys_hint") | ||
|
|
||
| = boolean_field :self_update |
There was a problem hiding this comment.
Good catch! I removed it.
05b21f5 to
8f70db2
Compare
| 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.
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
| 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)' |
| "access_keys": "", | ||
| "shell_prompt": "USER@HOST:CWD SUFFIX", | ||
| "enable_pxe": true, | ||
| "self_update_url": "", |
There was a problem hiding this comment.
So we don't provide a default value that just works? :-)
There was a problem hiding this comment.
:) 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.
I think the default should be the mirror on the admin server.
| 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.
Shouldn't we pass this only if self_update_url is not empty?
There was a problem hiding this comment.
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.
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.
I'll add a check whether the repository is actually there.
There was a problem hiding this comment.
I guess the check you mention here is still not there? :-)
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.
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.
Style/LeadingCommentSpace: Missing space after #. (https://github.com/bbatsov/ruby-style-guide#hash-space)
|
|
||
| @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.
Style/LeadingCommentSpace: Missing space after #. (https://github.com/bbatsov/ruby-style-guide#hash-space)
| end | ||
| end | ||
|
|
||
| @logger.info("validating existence of #{proposal["attributes"]["provisioner"]["self_update_url"]}") |
There was a problem hiding this comment.
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
aspiers
left a comment
There was a problem hiding this comment.
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? |
| "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.
Sorry, I failed to notice this earlier on, but we have a suse attribute, and this should live in there. See line 56.
| 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.
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.
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.
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.
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.
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.
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.
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.
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).