Skip to content
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

Merge SLE 15 SP3 #1154

Merged
merged 13 commits into from Apr 13, 2021
6 changes: 4 additions & 2 deletions library/general/src/lib/cfa/login_defs.rb
Expand Up @@ -65,6 +65,8 @@ class LoginDefs < BaseModel
:userdel_precmd
].freeze

DEFAULT_PATH = "/etc/login.defs".freeze

class << self
# Returns the list of known attributes
#
Expand All @@ -80,7 +82,7 @@ def known_attributes
# @param file_handler [#read,#write] something able to read/write a string (like File)
# @param file_path [String] File path
# @return [LoginDefs] File with the already loaded content
def load(file_path:, file_handler: Yast::TargetFile)
def load(file_path: DEFAULT_PATH, file_handler: Yast::TargetFile)
new(file_path: file_path, file_handler: file_handler).tap(&:load)
end
end
Expand All @@ -98,7 +100,7 @@ def load(file_path:, file_handler: Yast::TargetFile)
# @param file_path [String] File path
#
# @see CFA::BaseModel#initialize
def initialize(file_path:, file_handler: Yast::TargetFile)
def initialize(file_path: DEFAULT_PATH, file_handler: Yast::TargetFile)
super(AugeasParser.new("login_defs.lns"), file_path, file_handler: file_handler)
end

Expand Down
1 change: 0 additions & 1 deletion library/general/src/modules/ShadowConfig.rb
Expand Up @@ -23,7 +23,6 @@
module Yast
# This class allows to access the API to handle login.defs attributes from Perl
#
# @see CFA::LoginDefs
# @see CFA::ShadowConfig
class ShadowConfigClass < Module
include Logger
Expand Down
18 changes: 18 additions & 0 deletions library/general/test/cfa/login_defs_test.rb
Expand Up @@ -90,4 +90,22 @@
end
end
end

describe "#present_attributes" do
it "returns the list of present attributes" do
expect(login_defs.present_attributes).to include(*ATTRS_VALUES.keys)
end
end

describe "#conflicts" do
subject(:other) { described_class.new(file_path: file_path, file_handler: file_handler) }

before do
other.encrypt_method = "SHA256"
end

it "returns the list of attributes with different values" do
expect(login_defs.conflicts(other)).to eq([:encrypt_method])
end
end
end
6 changes: 6 additions & 0 deletions package/yast2.changes
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon Apr 12 15:12:41 UTC 2021 - Imobach Gonzalez Sosa <igonzalezsosa@suse.com>

- Add a default value for file_path argument in ::new and ::load
methods of CFA::LoginDefs class.

-------------------------------------------------------------------
Mon Mar 29 09:46:31 UTC 2021 - Imobach Gonzalez Sosa <igonzalezsosa@suse.com>

Expand Down