Hello community,

here is the log from the commit of package yast2 for openSUSE:Factory checked 
in at 2015-06-06 09:50:01
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2 (Old)
 and      /work/SRC/openSUSE:Factory/.yast2.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2"

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2/yast2.changes      2015-06-03 
08:28:52.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.yast2.new/yast2.changes 2015-06-06 
09:50:02.000000000 +0200
@@ -1,0 +2,15 @@
+Thu Jun  4 12:04:32 UTC 2015 - igonzalezs...@suse.com
+
+- Fix a typo when calling Linuxrc.value_for method
+- 3.1.130
+
+-------------------------------------------------------------------
+Tue Jun  2 16:42:43 CEST 2015 - loci...@suse.com
+
+- Implemented possibility to temporarily disable creating
+  snapshots via parameter on Linuxrc commandline:
+    disable_snapshots=(single|around|all)
+  or using their comma-separated combination (fate#317973)
+- 3.1.129
+
+-------------------------------------------------------------------

Old:
----
  yast2-3.1.128.tar.bz2

New:
----
  yast2-3.1.130.tar.bz2

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

Other differences:
------------------
++++++ yast2.spec ++++++
--- /var/tmp/diff_new_pack.d2MFio/_old  2015-06-06 09:50:03.000000000 +0200
+++ /var/tmp/diff_new_pack.d2MFio/_new  2015-06-06 09:50:03.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2
-Version:        3.1.128
+Version:        3.1.130
 Release:        0
 Url:            https://github.com/yast/yast-yast2
 

++++++ yast2-3.1.128.tar.bz2 -> yast2-3.1.130.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-3.1.128/library/general/src/modules/Linuxrc.rb 
new/yast2-3.1.130/library/general/src/modules/Linuxrc.rb
--- old/yast2-3.1.128/library/general/src/modules/Linuxrc.rb    2015-06-02 
14:31:10.000000000 +0200
+++ new/yast2-3.1.130/library/general/src/modules/Linuxrc.rb    2015-06-05 
08:46:08.000000000 +0200
@@ -31,6 +31,10 @@
 
 module Yast
   class LinuxrcClass < Module
+    # Disables filesystem snapshots (fate#317973)
+    # Possible values: all, post, pre, single
+    DISABLE_SNAPSHOTS = "disable_snapshots"
+
     def main
       Yast.import "Mode"
       Yast.import "Stage"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-3.1.128/library/system/src/lib/yast2/fs_snapshot.rb 
new/yast2-3.1.130/library/system/src/lib/yast2/fs_snapshot.rb
--- old/yast2-3.1.128/library/system/src/lib/yast2/fs_snapshot.rb       
2015-06-02 14:31:10.000000000 +0200
+++ new/yast2-3.1.130/library/system/src/lib/yast2/fs_snapshot.rb       
2015-06-05 08:46:08.000000000 +0200
@@ -58,6 +58,8 @@
   class FsSnapshot
     include Yast::Logger
 
+    Yast.import "Linuxrc"
+
     FIND_CONFIG_CMD = "/usr/bin/snapper --no-dbus --root=%{root} list-configs 
| grep \"^root \" >/dev/null"
     CREATE_SNAPSHOT_CMD = "/usr/lib/snapper/installation-helper --step 5 
--root-prefix=%{root} --snapshot-type %{snapshot_type} --description 
\"%{description}\""
     LIST_SNAPSHOTS_CMD = "LANG=en_US.UTF-8 /usr/bin/snapper --no-dbus 
--root=%{root} list"
@@ -82,13 +84,41 @@
       @configured = out["exit"] == 0
     end
 
-    # Creates a new 'single' snapshot
+    # Returns whether creating the given snapshot type is allowed
+    # Information is taken from Linuxrc (DISABLE_SNAPSHOTS)
+    #   * "all" - all snapshot types are temporarily disabled
+    #   * "around" - before and after calling YaST
+    #   * "single" - single snapshot at a given point
+    #
+    # @param [Symbol] one of :around (for :post and :pre snapshots) or :single
+    # @return [Boolean] if snapshot should be created
+    def self.create_snapshot?(snapshot_type)
+      disable_snapshots = 
Yast::Linuxrc.value_for(Yast::LinuxrcClass::DISABLE_SNAPSHOTS)
+
+      # Feature is not defined on Linuxrc commandline
+      return true if disable_snapshots.nil? || disable_snapshots.empty?
+
+      disable_snapshots = disable_snapshots.downcase.tr("-_.", "").split(",")
+
+      if [:around, :single].include?(snapshot_type)
+        return false if disable_snapshots.include?("all")
+        return !disable_snapshots.include?(snapshot_type.to_s)
+      else
+        raise ArgumentError, "Unsupported snapshot type 
#{snapshot_type.inspect}, " \
+              "supported are :around and :single"
+      end
+    end
+
+    # Creates a new 'single' snapshot unless disabled by user
     #
     # @param description [String] Snapshot's description.
     # @return [FsSnapshot] The created snapshot.
     #
     # @see FsSnapshot.create
+    # @see FsSnapshot.create_snapshot?
     def self.create_single(description)
+      return nil unless create_snapshot?(:single)
+
       create(:single, description)
     end
 
@@ -98,11 +128,14 @@
     # @return [FsSnapshot] The created snapshot.
     #
     # @see FsSnapshot.create
+    # @see FsSnapshot.create_snapshot?
     def self.create_pre(description)
+      return nil unless create_snapshot?(:around)
+
       create(:pre, description)
     end
 
-    # Creates a new 'post' snapshot
+    # Creates a new 'post' snapshot unless disabled by user
     #
     # Each 'post' snapshot corresponds with a 'pre' one.
     #
@@ -111,8 +144,12 @@
     # @return [FsSnapshot] The created snapshot.
     #
     # @see FsSnapshot.create
+    # @see FsSnapshot.create_snapshot?
     def self.create_post(description, previous_number)
+      return nil unless create_snapshot?(:around)
+
       previous = find(previous_number)
+
       if previous
         create(:post, description, previous)
       else
@@ -121,7 +158,7 @@
       end
     end
 
-    # Creates a new snapshot
+    # Creates a new snapshot unless disabled by user
     #
     # It raises an exception if Snapper is not configured or if snapshot
     # creation fails.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-3.1.128/library/system/test/fs_snapshot_test.rb 
new/yast2-3.1.130/library/system/test/fs_snapshot_test.rb
--- old/yast2-3.1.128/library/system/test/fs_snapshot_test.rb   2015-06-02 
14:31:10.000000000 +0200
+++ new/yast2-3.1.130/library/system/test/fs_snapshot_test.rb   2015-06-05 
08:46:08.000000000 +0200
@@ -84,10 +84,12 @@
 
     before do
       allow(Yast2::FsSnapshot).to receive(:configured?).and_return(configured)
+      allow(Yast2::FsSnapshot).to 
receive(:create_snapshot?).with(:single).and_return(create_snapshot)
     end
 
     context "when snapper is configured" do
       let(:configured) { true }
+      let(:create_snapshot) { true }
 
       before do
         allow(Yast::SCR).to receive(:Execute)
@@ -120,12 +122,22 @@
 
     context "when snapper is not configured" do
       let(:configured) { false }
+      let(:create_snapshot) { true }
 
       it "raises an exception" do
         expect { described_class.create_single("some-description") }
           .to raise_error(Yast2::SnapperNotConfigured)
       end
     end
+
+    context "when creating snapshots is disabled" do
+      let(:configured) { false }
+      let(:create_snapshot) { false }
+
+      it "returns nil" do
+        expect(described_class.create_single("some-description")).to eq(nil)
+      end
+    end
   end
 
   describe ".create_pre" do
@@ -134,10 +146,12 @@
 
     before do
       allow(Yast2::FsSnapshot).to receive(:configured?).and_return(configured)
+      allow(Yast2::FsSnapshot).to 
receive(:create_snapshot?).with(:around).and_return(create_snapshot)
     end
 
     context "when snapper is configured" do
       let(:configured) { true }
+      let(:create_snapshot) { true }
 
       before do
         allow(Yast::SCR).to receive(:Execute)
@@ -170,12 +184,22 @@
 
     context "when snapper is not configured" do
       let(:configured) { false }
+      let(:create_snapshot) { true }
 
       it "raises an exception" do
         expect { described_class.create_pre("some-description") }
           .to raise_error(Yast2::SnapperNotConfigured)
       end
     end
+
+    context "when creating snapshots is disabled" do
+      let(:configured) { false }
+      let(:create_snapshot) { false }
+
+      it "returns nil" do
+        expect(described_class.create_pre("some-description")).to eq(nil)
+      end
+    end
   end
 
   describe ".create_post" do
@@ -185,10 +209,12 @@
 
     before do
       allow(Yast2::FsSnapshot).to receive(:configured?).and_return(configured)
+      allow(Yast2::FsSnapshot).to 
receive(:create_snapshot?).with(:around).and_return(create_snapshot)
     end
 
     context "when snapper is configured" do
       let(:configured) { true }
+      let(:create_snapshot) { true }
 
       let(:pre_snapshot) { double("snapshot", snapshot_type: :pre, number: 2) }
       let(:dummy_snapshot) { double("snapshot") }
@@ -239,12 +265,22 @@
 
     context "when snapper is not configured" do
       let(:configured) { false }
+      let(:create_snapshot) { true }
 
       it "raises an exception" do
         expect { described_class.create_post("some-description", 1) }
           .to raise_error(Yast2::SnapperNotConfigured)
       end
     end
+
+    context "when creating snapshots is disabled" do
+      let(:configured) { false }
+      let(:create_snapshot) { false }
+
+      it "returns nil" do
+        expect(described_class.create_post("some-description", 999)).to eq(nil)
+      end
+    end
   end
 
   describe ".all" do
@@ -365,4 +401,57 @@
       end
     end
   end
+
+  describe ".create_snapshot?" do
+    before do
+      Yast.import "Linuxrc"
+    end
+
+    context "when single value is defined on Linuxrc commandline" do
+      it "returns whether given snapshot type is allowed" do
+        allow(Yast::Linuxrc).to 
receive(:value_for).with(/snapshot/).and_return("around")
+        expect(described_class.create_snapshot?(:around)).to eq(false)
+        expect(described_class.create_snapshot?(:single)).to eq(true)
+
+        allow(Yast::Linuxrc).to 
receive(:value_for).with(/snapshot/).and_return("single")
+        expect(described_class.create_snapshot?(:around)).to eq(true)
+        expect(described_class.create_snapshot?(:single)).to eq(false)
+
+        allow(Yast::Linuxrc).to 
receive(:value_for).with(/snapshot/).and_return("all")
+        expect(described_class.create_snapshot?(:around)).to eq(false)
+        expect(described_class.create_snapshot?(:single)).to eq(false)
+      end
+    end
+
+    context "when more values are defined on Linuxrc commandline" do
+      it "returns whether given snapshot type is not within disabled snapshots 
types" do
+        allow(Yast::Linuxrc).to 
receive(:value_for).with(/snapshot/).and_return("single,around")
+        expect(described_class.create_snapshot?(:around)).to eq(false)
+        expect(described_class.create_snapshot?(:single)).to eq(false)
+
+        allow(Yast::Linuxrc).to 
receive(:value_for).with(/snapshot/).and_return("all,around")
+        expect(described_class.create_snapshot?(:around)).to eq(false)
+        expect(described_class.create_snapshot?(:single)).to eq(false)
+      end
+    end
+
+    context "when no value is defined on Linuxrc commandline" do
+      it "returns that any snapshots are allowed" do
+        allow(Yast::Linuxrc).to 
receive(:value_for).with(/snapshot/).and_return(nil)
+        expect(described_class.create_snapshot?(:around)).to eq(true)
+        expect(described_class.create_snapshot?(:single)).to eq(true)
+
+        allow(Yast::Linuxrc).to 
receive(:value_for).with(/snapshot/).and_return("")
+        expect(described_class.create_snapshot?(:around)).to eq(true)
+        expect(described_class.create_snapshot?(:single)).to eq(true)
+      end
+    end
+
+    context "when called with unsupported parameter value" do
+      it "throws an ArgumentError exception" do
+        allow(Yast::Linuxrc).to 
receive(:value_for).with(/snapshot/).and_return("all")
+        expect { described_class.create_snapshot?(:some) }.to 
raise_error(ArgumentError, /:some/)
+      end
+    end
+  end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-3.1.128/package/yast2.changes 
new/yast2-3.1.130/package/yast2.changes
--- old/yast2-3.1.128/package/yast2.changes     2015-06-02 14:31:10.000000000 
+0200
+++ new/yast2-3.1.130/package/yast2.changes     2015-06-05 08:46:08.000000000 
+0200
@@ -1,4 +1,19 @@
 -------------------------------------------------------------------
+Thu Jun  4 12:04:32 UTC 2015 - igonzalezs...@suse.com
+
+- Fix a typo when calling Linuxrc.value_for method
+- 3.1.130
+
+-------------------------------------------------------------------
+Tue Jun  2 16:42:43 CEST 2015 - loci...@suse.com
+
+- Implemented possibility to temporarily disable creating
+  snapshots via parameter on Linuxrc commandline:
+    disable_snapshots=(single|around|all)
+  or using their comma-separated combination (fate#317973)
+- 3.1.129
+
+-------------------------------------------------------------------
 Tue Jun  2 11:26:50 UTC 2015 - jreidin...@suse.com
 
 - reduce count of extending inst-sys with snapper for snapshotting
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-3.1.128/package/yast2.spec 
new/yast2-3.1.130/package/yast2.spec
--- old/yast2-3.1.128/package/yast2.spec        2015-06-02 14:31:10.000000000 
+0200
+++ new/yast2-3.1.130/package/yast2.spec        2015-06-05 08:46:08.000000000 
+0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2
-Version:        3.1.128
+Version:        3.1.130
 Release:        0
 URL:            https://github.com/yast/yast-yast2
 


Reply via email to