Hello community,

here is the log from the commit of package yast2-journal for openSUSE:Factory 
checked in at 2018-08-31 10:45:06
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-journal (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-journal.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-journal"

Fri Aug 31 10:45:06 2018 rev:10 rq:632103 version:4.1.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-journal/yast2-journal.changes      
2018-06-28 15:13:37.199570783 +0200
+++ /work/SRC/openSUSE:Factory/.yast2-journal.new/yast2-journal.changes 
2018-08-31 10:45:08.051252219 +0200
@@ -1,0 +2,7 @@
+Tue Aug 28 11:17:02 UTC 2018 - lsle...@suse.cz
+
+- Do not crash when changing the filter as a non-root user
+  (bsc#1089626)
+- 4.1.2
+
+-------------------------------------------------------------------

Old:
----
  yast2-journal-4.1.1.tar.bz2

New:
----
  yast2-journal-4.1.2.tar.bz2

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

Other differences:
------------------
++++++ yast2-journal.spec ++++++
--- /var/tmp/diff_new_pack.6NC6Tf/_old  2018-08-31 10:45:08.491252750 +0200
+++ /var/tmp/diff_new_pack.6NC6Tf/_new  2018-08-31 10:45:08.491252750 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-journal
-Version:        4.1.1
+Version:        4.1.2
 Release:        0
 BuildArch:      noarch
 

++++++ yast2-journal-4.1.1.tar.bz2 -> yast2-journal-4.1.2.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-journal-4.1.1/README.md 
new/yast2-journal-4.1.2/README.md
--- old/yast2-journal-4.1.1/README.md   2018-06-27 12:31:24.000000000 +0200
+++ new/yast2-journal-4.1.2/README.md   2018-08-29 10:36:54.000000000 +0200
@@ -8,6 +8,12 @@
 A module for [YaST](http://yast.github.io) to read the systemd journal in a
 user-friendly way.
 
+### Notes
+
+- This module can be used by non-root users. By default the non-root users
+  do not have the permission to read the journal, to allow specific users
+  reading the journal add them to the `systemd-journal` user group.
+
 Further information
 -------------------
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-journal-4.1.1/package/yast2-journal.changes 
new/yast2-journal-4.1.2/package/yast2-journal.changes
--- old/yast2-journal-4.1.1/package/yast2-journal.changes       2018-06-27 
12:31:24.000000000 +0200
+++ new/yast2-journal-4.1.2/package/yast2-journal.changes       2018-08-29 
10:36:54.000000000 +0200
@@ -1,4 +1,11 @@
 -------------------------------------------------------------------
+Tue Aug 28 11:17:02 UTC 2018 - lsle...@suse.cz
+
+- Do not crash when changing the filter as a non-root user
+  (bsc#1089626)
+- 4.1.2
+
+-------------------------------------------------------------------
 Tue Jun 26 13:23:35 UTC 2018 - jlo...@suse.com
 
 - Change namespace according to YaST naming conventions. Now this
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-journal-4.1.1/package/yast2-journal.spec 
new/yast2-journal-4.1.2/package/yast2-journal.spec
--- old/yast2-journal-4.1.1/package/yast2-journal.spec  2018-06-27 
12:31:24.000000000 +0200
+++ new/yast2-journal-4.1.2/package/yast2-journal.spec  2018-08-29 
10:36:54.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-journal
-Version:        4.1.1
+Version:        4.1.2
 Release:        0
 BuildArch:      noarch
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-journal-4.1.1/src/lib/y2journal/entries_dialog.rb 
new/yast2-journal-4.1.2/src/lib/y2journal/entries_dialog.rb
--- old/yast2-journal-4.1.1/src/lib/y2journal/entries_dialog.rb 2018-06-27 
12:31:24.000000000 +0200
+++ new/yast2-journal-4.1.2/src/lib/y2journal/entries_dialog.rb 2018-08-29 
10:36:54.000000000 +0200
@@ -20,10 +20,11 @@
 require "ui/dialog"
 require "y2journal/query_presenter"
 require "y2journal/query_dialog"
+require "y2journal/journalctl_exception"
+require "yast2/popup.rb"
 
 Yast.import "UI"
 Yast.import "Label"
-Yast.import "Popup"
 
 module Y2Journal
   # Dialog to display journal entries with several filtering options
@@ -162,6 +163,9 @@
         log.info "QueryDialog returned nil. Query is still #{@query}."
         false
       end
+    rescue JournalctlException => e
+      journalctl_failed(e.message)
+      false
     end
 
     # Reads the journal entries from the system
@@ -169,9 +173,18 @@
       log.info "Executing query #{@query.journalctl_options}"
       @query.execute
       log.info "Call to journalctl returned #{@query.entries.size} entries."
-    rescue => e
-      log.warn e.message
-      Yast::Popup.Message(e.message)
+    rescue JournalctlException => e
+      journalctl_failed(e.message)
+    end
+
+    #
+    # Report a journalctl failure to the user.
+    #
+    # @param details [String] details of the failure
+    #
+    def journalctl_failed(details)
+      log.warn "journalctl failed, displaying empty result"
+      Yast2::Popup.show(_("Reading the journal entries failed."), details: 
details)
     end
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-journal-4.1.1/src/lib/y2journal/journalctl.rb 
new/yast2-journal-4.1.2/src/lib/y2journal/journalctl.rb
--- old/yast2-journal-4.1.1/src/lib/y2journal/journalctl.rb     2018-06-27 
12:31:24.000000000 +0200
+++ new/yast2-journal-4.1.2/src/lib/y2journal/journalctl.rb     2018-08-29 
10:36:54.000000000 +0200
@@ -16,6 +16,8 @@
 #  To contact SUSE about this file by physical or electronic mail,
 #  you may find current contact information at www.suse.com
 
+require "y2journal/journalctl_exception"
+
 module Y2Journal
   # Wrapper for journalctl invocation
   class Journalctl
@@ -71,7 +73,7 @@
         # Most likely, journalctl bug when an empty list is found
         ""
       else
-        raise "Calling journalctl failed: #{cmd_result["stderr"]}"
+        raise JournalctlException, cmd_result["stderr"]
       end
     end
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-journal-4.1.1/src/lib/y2journal/journalctl_exception.rb 
new/yast2-journal-4.1.2/src/lib/y2journal/journalctl_exception.rb
--- old/yast2-journal-4.1.1/src/lib/y2journal/journalctl_exception.rb   
1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-journal-4.1.2/src/lib/y2journal/journalctl_exception.rb   
2018-08-29 10:36:54.000000000 +0200
@@ -0,0 +1,23 @@
+# Copyright (c) 2018 SUSE LLC.
+#  All Rights Reserved.
+
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of version 2 or 3 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 about this file by physical or electronic mail,
+#  you may find current contact information at www.suse.com
+
+module Y2Journal
+  # Exception for a failed journalctl invocation
+  class JournalctlException < RuntimeError
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-journal-4.1.1/src/lib/y2journal.rb 
new/yast2-journal-4.1.2/src/lib/y2journal.rb
--- old/yast2-journal-4.1.1/src/lib/y2journal.rb        2018-06-27 
12:31:24.000000000 +0200
+++ new/yast2-journal-4.1.2/src/lib/y2journal.rb        2018-08-29 
10:36:54.000000000 +0200
@@ -26,3 +26,4 @@
 require "y2journal/query_presenter"
 require "y2journal/query_dialog"
 require "y2journal/journalctl"
+require "y2journal/journalctl_exception"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-journal-4.1.1/test/entries_dialog_test.rb 
new/yast2-journal-4.1.2/test/entries_dialog_test.rb
--- old/yast2-journal-4.1.1/test/entries_dialog_test.rb 2018-06-27 
12:31:24.000000000 +0200
+++ new/yast2-journal-4.1.2/test/entries_dialog_test.rb 2018-08-29 
10:36:54.000000000 +0200
@@ -28,6 +28,9 @@
     allow(query).to receive(:entries).and_return([])
     query
   end
+
+  # journalctl error message
+  let(:details) { "failed!" }
   subject { described_class.new(query: query) }
 
   describe "#initialize" do
@@ -53,4 +56,19 @@
       expect(subject.dialog_options).to be_a(Yast::Term)
     end
   end
+
+  describe "#filter_handler" do
+    it "reports an error when journalctl fails" do
+      expect_any_instance_of(Y2Journal::QueryDialog).to receive(:run)
+        .and_raise(Y2Journal::JournalctlException, details)
+      expect(Yast2::Popup).to receive(:show).with(anything, details: details)
+
+      # mock the other methods
+      allow(subject).to receive(:redraw_query)
+      allow(subject).to receive(:execute_query)
+      allow(subject).to receive(:redraw_table)
+
+      expect { subject.filter_handler }.to_not raise_error
+    end
+  end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-journal-4.1.1/test/spec_helper.rb 
new/yast2-journal-4.1.2/test/spec_helper.rb
--- old/yast2-journal-4.1.1/test/spec_helper.rb 2018-06-27 12:31:24.000000000 
+0200
+++ new/yast2-journal-4.1.2/test/spec_helper.rb 2018-08-29 10:36:54.000000000 
+0200
@@ -76,3 +76,12 @@
   file = File.join(DATA_PATH, "#{name}-entry.json")
   File.open(file, encoding: "UTF-8", &:read)
 end
+
+# configure RSpec
+RSpec.configure do |config|
+  config.mock_with :rspec do |c|
+    # verify that the mocked methods are really defined
+    # 
https://relishapp.com/rspec/rspec-mocks/v/3-0/docs/verifying-doubles/partial-doubles
+    c.verify_partial_doubles = true
+  end
+end


Reply via email to