-
Notifications
You must be signed in to change notification settings - Fork 69
feat(ruby): import AutoYaST dns settings #2335
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
Merged
Merged
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
1f59e3b
feat(ruby): import DNS settings from AutoYaST
imobachgs 96a31ea
feat(ruby): import the hostname from AutoYaST
imobachgs 726f116
docs(ruby): add dns to the AutoYaST compatibility document
imobachgs 22ed262
chore(ruby): format the AutoYaST compatibility document
imobachgs f8fa38d
chore(ruby): update the changes file
imobachgs a9d8c8f
chore(ruby): add an intro text doc:autoyast_compat
imobachgs 8aca1ba
docs(ruby): update add-on status in the AutoYaST compat document
imobachgs d69ba77
Merge branch 'master' into convert-dns
imobachgs 02db730
Update service/test/agama/autoyast/hostname_reader_test.rb
imobachgs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| # Copyright (c) [2025] SUSE LLC | ||
| # | ||
| # All Rights Reserved. | ||
| # | ||
| # This program is free software; you can redistribute it and/or modify it | ||
| # under the terms of version 2 of the GNU General Public License as published | ||
| # by the Free Software Foundation. | ||
| # | ||
| # This program is distributed in the hope that it will be useful, but WITHOUT | ||
| # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| # more details. | ||
| # | ||
| # You should have received a copy of the GNU General Public License along | ||
| # with this program; if not, contact SUSE LLC. | ||
| # | ||
| # To contact SUSE LLC about this file by physical or electronic mail, you may | ||
| # find current contact information at www.suse.com. | ||
|
|
||
| require "yast" | ||
|
|
||
| # :nodoc: | ||
| module Agama | ||
| module AutoYaST | ||
| # Builds the Agama "network.hostname" section from an AutoYaST profile. | ||
| class HostnameReader | ||
| # @param profile [ProfileHash] AutoYaST profile | ||
| def initialize(profile) | ||
| @profile = profile | ||
| end | ||
|
|
||
| # @return [Hash] Agama "hostname" section. | ||
| def read | ||
| networking = profile.fetch_as_hash("networking") | ||
| dns = networking.fetch_as_hash("dns") | ||
| hostname = dns["hostname"] | ||
| return {} if hostname.to_s.empty? | ||
|
|
||
| { "hostname" => { "static" => hostname } } | ||
| end | ||
|
|
||
| private | ||
|
|
||
| attr_reader :profile | ||
| end | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,8 @@ | ||
| ------------------------------------------------------------------- | ||
| Wed May 7 10:24:14 UTC 2025 - Imobach Gonzalez Sosa <[email protected]> | ||
|
|
||
| - Convert AutoYaST DNS section to JSON (gh#agama-project/agama#2335). | ||
|
|
||
| ------------------------------------------------------------------- | ||
| Wed May 7 06:33:28 UTC 2025 - José Iván López González <[email protected]> | ||
|
|
||
|
|
@@ -26,7 +31,7 @@ Fri Apr 25 13:36:13 UTC 2025 - Ancor Gonzalez Sosa <[email protected]> | |
| Thu Apr 24 17:18:04 UTC 2025 - Knut Anderssen <[email protected]> | ||
|
|
||
| - Copy only the NetworkManager connnections from /etc and just | ||
| in case the copy has not been disabled | ||
| in case the copy has not been disabled | ||
| (gh#agama-project/agama#2291). | ||
|
|
||
| ------------------------------------------------------------------- | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| # Copyright (c) [2024] SUSE LLC | ||
| # | ||
| # All Rights Reserved. | ||
| # | ||
| # This program is free software; you can redistribute it and/or modify it | ||
| # under the terms of version 2 of the GNU General Public License as published | ||
| # by the Free Software Foundation. | ||
| # | ||
| # This program is distributed in the hope that it will be useful, but WITHOUT | ||
| # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| # more details. | ||
| # | ||
| # You should have received a copy of the GNU General Public License along | ||
| # with this program; if not, contact SUSE LLC. | ||
| # | ||
| # To contact SUSE LLC about this file by physical or electronic mail, you may | ||
| # find current contact information at www.suse.com. | ||
|
|
||
| require_relative "../../test_helper" | ||
| require "yast" | ||
| require "agama/autoyast/hostname_reader" | ||
|
|
||
| Yast.import "Profile" | ||
|
|
||
| describe Agama::AutoYaST::HostnameReader do | ||
| let(:profile) do | ||
| { | ||
| "networking" => { | ||
| "dns" => { | ||
| "hostname" => "host.example.lan" | ||
| } | ||
| } | ||
| } | ||
| end | ||
|
|
||
| subject do | ||
| described_class.new(Yast::ProfileHash.new(profile)) | ||
| end | ||
|
|
||
| describe "#read" do | ||
| context "when there is no 'networking' section" do | ||
| let(:profile) { {} } | ||
|
|
||
| it "returns an empty hash" do | ||
| expect(subject.read).to be_empty | ||
| end | ||
| end | ||
|
|
||
| context "when there is no 'hostname' property" do | ||
| let(:profile) { { "networking" => {} } } | ||
|
|
||
| it "returns an empty hash" do | ||
| expect(subject.read).to be_empty | ||
| end | ||
| end | ||
|
|
||
| it "returns a hash containing the hostname" do | ||
| expect(subject.read["hostname"]).to eq("static" => "host.example.lan") | ||
| end | ||
| end | ||
| end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.