-
Notifications
You must be signed in to change notification settings - Fork 34
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
[Sle15] AY setup written in first stage #520
Conversation
79466b0
to
05a14a4
Compare
05a14a4
to
e03e09a
Compare
package/yast2-network.changes
Outdated
@@ -1,4 +1,12 @@ | |||
------------------------------------------------------------------- | |||
Fri Jun 9 09:40:11 UTC 2017 - mfilka@suse.com | |||
|
|||
- Moving network setup in AY into 1s stage |
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.
"1st"
Bug or feature number?
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.
currently not aware of any - the PBI contains no fate number
@kobliha: is there any fate request?
src/clients/save_network.rb
Outdated
|
||
NetworkAutoYast.instance.configure_nics | ||
end | ||
|
||
# It does an automatic configuration of installed system |
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.
AFAIK formerly this was not associated with AutoYaST. So we should explicitly point this out:
It works for both values of Mode.autoinst
BTW, what about autoupgrade? http://www.rubydoc.info/github/yast/yast-yast2/Yast/ModeClass
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.
upgrade scenario ignores network setup ... but i'm not sure about autoupgrade - will check
src/lib/network/network_autoyast.rb
Outdated
# we neet to guarantee order of the items here | ||
[host["host_address"] || "", host["names"] || []] | ||
end | ||
hosts_config = hosts_config.to_h.delete_if { |k, v| k.empty? || v.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.
This non-trivial FromAY-like section should go into its own method (class?) and be covered with tests.
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 this is almost everything what configure_hosts
does
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, now that the other configure_* methods are gone it makes less sense to split it off. Still, with all the "or empty" logic in here, tests are needed.
Also, how does this code relate to Import in host_auto? Do we need to "guarantee item order" also 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.
Item order is most probably bad description here. I refer to "host_address" and "names". Each of these hash keys refer to a xml node. And this nodes can be ordered differently in the profile. We must guarantee that "host_address" is at first place.
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 that this duplicates Host.Import
. Is that one obsolete then?
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.
Ah, sorry, configure_submodule
does call Import
src/modules/DNS.rb
Outdated
# | ||
# return {true, false, nil} "yes" => true, "no" => false, otherwise or not | ||
# present => nil | ||
def write_hostname_to_hosts |
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 method named write_*
that in fact calls SCR.Read
?! I know it copies the sysconfig name but here I would prefix it with should_
or something.
src/modules/DNS.rb
Outdated
Builtins.sleep(sl) | ||
ProgressNextStage(_("Writing hostname...")) if gui | ||
update_hostname | ||
Builtins.sleep(0) if gui |
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.
Ugh, what?!
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.
hm, consequence of some massive updating and code shifting and so on. I'll drop it.
src/modules/DNS.rb
Outdated
SCR.Write( | ||
path(".sysconfig.network.dhcp.WRITE_HOSTNAME_TO_HOSTS"), | ||
@write_hostname ? "yes" : "no" | ||
) if !@write_hostname |
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.
Bug.
For use when running first stage mode only
01e19ae
to
be9825b
Compare
be9825b
to
766076d
Compare
does host_auto#Import need similar code like configure_hosts? |
src/lib/network/network_autoyast.rb
Outdated
# hosts => [ | ||
# # first <host_entry> | ||
# { | ||
# "hosts_address" => <ip>, |
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. "host_address"
.
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
end | ||
|
||
# Returns networking section of current AY profile | ||
def ay_networking_section |
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.
IMHO it would be more clear to replace this method by inlining ay_current_profile.fetch("networking", {})
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.
regarding Host.Import
see bellow
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.
in my POV "networking" section is used quite often so it deserved own method as a shortcut.
src/lib/network/network_autoyast.rb
Outdated
# we neet to guarantee order of the items here | ||
[host["host_address"] || "", host["names"] || []] | ||
end | ||
hosts_config = hosts_config.to_h.delete_if { |k, v| k.empty? || v.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.
I think that this duplicates Host.Import
. Is that one obsolete then?
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.
Does this PR mean that the lan_auto+host_auto clients are obsolete, as far as Write is concerned? And they are only useful for the AY config GUI? So /usr/share/YaST2/clients/ayast_setup.rb will no longer work for networking, or work differently ?
src/lib/network/network_autoyast.rb
Outdated
|
||
true | ||
# expected format for Hosts.Import is { "ip" => [list, of, names] } |
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, and this must be documented there, in the API docs for Host.Import (not Hosts).
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
Writing in first stage is experimental feature from my POV and is used only when second stage is disabled. Othewise _auto clients are used in second stage. See AY integration tests for some more details. |
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 have added tests b2b58c0 , but since you do this in your own repo, there is more work for you to merge them. Wanna push to the shared repo the next time?
package/yast2-network.changes
Outdated
@@ -1,4 +1,12 @@ | |||
------------------------------------------------------------------- | |||
Fri Jul 11 09:40:11 UTC 2017 - mfilka@suse.com | |||
|
|||
- Moving network setup in AY into first stage |
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.
As this is a major thing we should have a public bug for this. I could not find one in https://trello.com/c/dxyLJ9c8/956-8-sle-15-%E2%9A%A1-autoyast-configure-the-whole-network-in-the-first-stage so should I create one?
Also, /etc/hosts should be mentioned.
Thanks for the review |
See yast/aytests-tests#77 (DNS test)