Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package yast2-security for openSUSE:Factory 
checked in at 2021-07-17 23:36:28
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-security (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-security.new.2632 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-security"

Sat Jul 17 23:36:28 2021 rev:106 rq:906477 version:4.4.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-security/yast2-security.changes    
2021-05-02 18:36:27.980858245 +0200
+++ /work/SRC/openSUSE:Factory/.yast2-security.new.2632/yast2-security.changes  
2021-07-17 23:36:51.153870820 +0200
@@ -1,0 +2,7 @@
+Wed Jul 14 13:51:18 UTC 2021 - Jos?? Iv??n L??pez Gonz??lez <jlo...@suse.com>
+
+- Add Security#SafeRead to allow detecting read errors when calling
+  it from perl modules (related to bsc#1177183).
+- 4.4.1
+
+-------------------------------------------------------------------

Old:
----
  yast2-security-4.4.0.tar.bz2

New:
----
  yast2-security-4.4.1.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ yast2-security.spec ++++++
--- /var/tmp/diff_new_pack.1GHRlS/_old  2021-07-17 23:36:51.581867520 +0200
+++ /var/tmp/diff_new_pack.1GHRlS/_new  2021-07-17 23:36:51.585867489 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-security
-Version:        4.4.0
+Version:        4.4.1
 Release:        0
 Summary:        YaST2 - Security Configuration
 License:        GPL-2.0-only

++++++ yast2-security-4.4.0.tar.bz2 -> yast2-security-4.4.1.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-security-4.4.0/package/yast2-security.changes 
new/yast2-security-4.4.1/package/yast2-security.changes
--- old/yast2-security-4.4.0/package/yast2-security.changes     2021-04-30 
18:20:12.000000000 +0200
+++ new/yast2-security-4.4.1/package/yast2-security.changes     2021-07-15 
16:26:01.000000000 +0200
@@ -1,4 +1,11 @@
 -------------------------------------------------------------------
+Wed Jul 14 13:51:18 UTC 2021 - Jos?? Iv??n L??pez Gonz??lez <jlo...@suse.com>
+
+- Add Security#SafeRead to allow detecting read errors when calling
+  it from perl modules (related to bsc#1177183).
+- 4.4.1
+
+-------------------------------------------------------------------
 Tue Apr 20 13:51:55 UTC 2021 - Ladislav Slez??k <lsle...@suse.cz>
 
 - 4.4.0 (bsc#1185510)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-security-4.4.0/package/yast2-security.spec 
new/yast2-security-4.4.1/package/yast2-security.spec
--- old/yast2-security-4.4.0/package/yast2-security.spec        2021-04-30 
18:20:12.000000000 +0200
+++ new/yast2-security-4.4.1/package/yast2-security.spec        2021-07-15 
16:26:01.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-security
-Version:        4.4.0
+Version:        4.4.1
 Release:        0
 Group:          System/YaST
 License:        GPL-2.0-only
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-security-4.4.0/src/modules/Security.rb 
new/yast2-security-4.4.1/src/modules/Security.rb
--- old/yast2-security-4.4.0/src/modules/Security.rb    2021-04-30 
18:20:12.000000000 +0200
+++ new/yast2-security-4.4.1/src/modules/Security.rb    2021-07-15 
16:26:01.000000000 +0200
@@ -35,7 +35,7 @@
 require "y2security/selinux"
 
 module Yast
-  class SecurityClass < Module
+  class SecurityClass < Module # rubocop:disable Metrics/ClassLength
     DEFAULT_ENCRYPT_METHOD = "sha512".freeze
     private_constant :DEFAULT_ENCRYPT_METHOD
 
@@ -463,7 +463,9 @@
     end
 
     # Read all security settings
-    # @return true on success
+    #
+    # @raise [Exception] if there is an issue while reading the settings
+    # @return [Boolean] true on success
     def Read
       @Settings = {}
       @modified = false
@@ -497,6 +499,23 @@
       true
     end
 
+    # Reads all security settings without raising exceptions
+    #
+    # This method saves any error produced while reading the settings instead 
of raising an
+    # exception. This is needed when the module is used from a perl module 
because the exceptions
+    # are not propagated to perl code.
+    #
+    # @return [Boolean] true on success. When false, the error message can be 
check by calling to
+    #   Security#read_error.
+    def SafeRead
+      @read_error = nil
+      self.Read
+      true
+    rescue StandardError => e
+      @read_error = e.message
+      false
+    end
+
     # Write the value of ctrl-alt-delete behavior
     def write_console_shutdown(ca)
       if ca == "reboot"
@@ -888,11 +907,13 @@
     publish :variable => :modified, :type => "boolean"
     publish :variable => :proposal_valid, :type => "boolean"
     publish :variable => :write_only, :type => "boolean"
+    publish :variable => :read_error, :type => "string"
     publish :function => :GetModified, :type => "boolean ()"
     publish :function => :SetModified, :type => "void ()"
     publish :function => :Modified, :type => "boolean ()"
     publish :function => :ReadServiceSettings, :type => "void ()"
     publish :function => :Read, :type => "boolean ()"
+    publish :function => :SafeRead, :type => "boolean ()"
     publish :function => :Write, :type => "boolean ()"
     publish :function => :Import, :type => "boolean (map)"
     publish :function => :Export, :type => "map ()"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-security-4.4.0/test/security_test.rb 
new/yast2-security-4.4.1/test/security_test.rb
--- old/yast2-security-4.4.0/test/security_test.rb      2021-04-30 
18:20:12.000000000 +0200
+++ new/yast2-security-4.4.1/test/security_test.rb      2021-07-15 
16:26:01.000000000 +0200
@@ -702,6 +702,46 @@
       end
     end
 
+    describe "#SafeRead" do
+      it "reads settings" do
+        expect(Security).to receive(:Read).and_return(true)
+
+        Security.SafeRead
+      end
+
+      context "when there is no error reading the settings" do
+        before do
+          allow(Security).to receive(:Read).and_return(true)
+        end
+
+        it "returns true" do
+          expect(Security.SafeRead).to eq(true)
+        end
+
+        it "does not store a read error" do
+          Security.SafeRead
+
+          expect(Security.read_error).to be_nil
+        end
+      end
+
+      context "when there is an error reading the settings" do
+        before do
+          allow(Security).to receive(:Read).and_raise "read error"
+        end
+
+        it "returns false" do
+          expect(Security.SafeRead).to eq(false)
+        end
+
+        it "stores a read error" do
+          Security.SafeRead
+
+          expect(Security.read_error).to eq("read error")
+        end
+      end
+    end
+
     describe "#Import" do
       let(:selinux_patterns) { ["example-selinux-patterns"] }
 

Reply via email to