Hello community,
here is the log from the commit of package yast2-firstboot for openSUSE:Factory checked in at 2019-02-15 09:53:46
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-firstboot (Old)
and /work/SRC/openSUSE:Factory/.yast2-firstboot.new.28833 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-firstboot"
Fri Feb 15 09:53:46 2019 rev:77 rq:674525 version:4.1.5
Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-firstboot/yast2-firstboot.changes 2019-02-04 21:11:14.751872633 +0100
+++ /work/SRC/openSUSE:Factory/.yast2-firstboot.new.28833/yast2-firstboot.changes 2019-02-15 09:53:46.639790769 +0100
@@ -1,0 +2,7 @@
+Fri Feb 8 07:25:32 UTC 2019 - Imobach Gonzalez Sosa
+
+- Support going back when using the yast2-configuration-management
+ module integration (fate#322722).
+- 4.1.5
+
+-------------------------------------------------------------------
Old:
----
yast2-firstboot-4.1.4.tar.bz2
New:
----
yast2-firstboot-4.1.5.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-firstboot.spec ++++++
--- /var/tmp/diff_new_pack.nKYPYu/_old 2019-02-15 09:53:47.803790402 +0100
+++ /var/tmp/diff_new_pack.nKYPYu/_new 2019-02-15 09:53:47.835790392 +0100
@@ -17,7 +17,7 @@
Name: yast2-firstboot
-Version: 4.1.4
+Version: 4.1.5
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@@ -39,7 +39,7 @@
BuildArch: noarch
-Requires: yast2-configuration-management >= 4.1.1
+Requires: yast2-configuration-management >= 4.1.3
Requires: yast2-ruby-bindings >= 1.0.0
Summary: YaST2 - Initial System Configuration
++++++ yast2-firstboot-4.1.4.tar.bz2 -> yast2-firstboot-4.1.5.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firstboot-4.1.4/package/yast2-firstboot.changes new/yast2-firstboot-4.1.5/package/yast2-firstboot.changes
--- old/yast2-firstboot-4.1.4/package/yast2-firstboot.changes 2019-01-28 12:15:42.000000000 +0100
+++ new/yast2-firstboot-4.1.5/package/yast2-firstboot.changes 2019-02-13 13:24:02.000000000 +0100
@@ -1,4 +1,11 @@
-------------------------------------------------------------------
+Fri Feb 8 07:25:32 UTC 2019 - Imobach Gonzalez Sosa
+
+- Support going back when using the yast2-configuration-management
+ module integration (fate#322722).
+- 4.1.5
+
+-------------------------------------------------------------------
Fri Jan 25 14:59:38 UTC 2019 - igonzalezsosa@suse.com
- Add integration with the yast2-configuration-management module
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firstboot-4.1.4/package/yast2-firstboot.spec new/yast2-firstboot-4.1.5/package/yast2-firstboot.spec
--- old/yast2-firstboot-4.1.4/package/yast2-firstboot.spec 2019-01-28 12:15:42.000000000 +0100
+++ new/yast2-firstboot-4.1.5/package/yast2-firstboot.spec 2019-02-13 13:24:02.000000000 +0100
@@ -16,7 +16,7 @@
#
Name: yast2-firstboot
-Version: 4.1.4
+Version: 4.1.5
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@@ -39,7 +39,7 @@
BuildArchitectures: noarch
Requires: yast2-ruby-bindings >= 1.0.0
-Requires: yast2-configuration-management >= 4.1.1
+Requires: yast2-configuration-management >= 4.1.3
Summary: YaST2 - Initial System Configuration
PreReq: %fillup_prereq
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firstboot-4.1.4/src/lib/y2firstboot/clients/configuration_management.rb new/yast2-firstboot-4.1.5/src/lib/y2firstboot/clients/configuration_management.rb
--- old/yast2-firstboot-4.1.4/src/lib/y2firstboot/clients/configuration_management.rb 2019-01-28 12:15:42.000000000 +0100
+++ new/yast2-firstboot-4.1.5/src/lib/y2firstboot/clients/configuration_management.rb 2019-02-13 13:24:02.000000000 +0100
@@ -20,11 +20,12 @@
# find current contact information at www.suse.com.
require "yast"
-require "configuration_management/clients/provision"
-require "configuration_management/configurators/base"
+require "y2configuration_management/clients/provision"
+require "y2configuration_management/configurators/base"
Yast.import "ProductFeatures"
Yast.import "PackageSystem"
+Yast.import "GetInstArgs"
module Y2Firstboot
module Clients
@@ -32,17 +33,24 @@
class ConfigurationManagement
# Runs the client
def run
- configurator = Yast::ConfigurationManagement::Configurators::Base.for(config)
- return :abort unless configurator.prepare
- if !Yast::PackageSystem.CheckAndInstallPackages(configurator.packages.fetch("install", []))
- return :abort
- end
- Yast::ConfigurationManagement::Clients::Provision.new.run
- :auto
+ configurator = Y2ConfigurationManagement::Configurators::Base.for(config)
+ result = configurator.prepare(reverse: Yast::GetInstArgs.going_back)
+ return result unless result == :finish
+ provision ? :next : :abort
end
private
+ # Runs the provisioner
+ #
+ # @return [Boolean] true if it ran successfully; false otherwise.
+ def provision
+ if !Yast::PackageSystem.CheckAndInstallPackages(configurator.packages.fetch("install", []))
+ return false
+ end
+ Y2ConfigurationManagement::Clients::Provision.new.run
+ end
+
# @return [Hash] Fixed settings (these settings cannot be overriden as this is the only
# supported scenario)
FIXED_SETTINGS = { "type" => "salt", "mode" => "masterless" }.freeze
@@ -51,11 +59,21 @@
#
# It relies in the configuration found in the control file.
#
- # @return [Yast::ConfigurationManagement::Configurations::Base]
+ # @return [Y2ConfigurationManagement::Configurations::Base]
def config
+ current_config = Y2ConfigurationManagement::Configurations::Base.current
+ return current_config if current_config
settings = Yast::ProductFeatures.GetSection("configuration_management")
.merge(FIXED_SETTINGS)
- Yast::ConfigurationManagement::Configurations::Base.import(settings)
+ Y2ConfigurationManagement::Configurations::Base.current =
+ Y2ConfigurationManagement::Configurations::Base.import(settings)
+ end
+
+ def configurator
+ current_configurator = Y2ConfigurationManagement::Configurators::Base.current
+ return current_configurator if current_configurator
+ Y2ConfigurationManagement::Configurators::Base.current =
+ Y2ConfigurationManagement::Configurators::Base.for(config)
end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-firstboot-4.1.4/test/y2firstboot/clients/configuration_management_test.rb new/yast2-firstboot-4.1.5/test/y2firstboot/clients/configuration_management_test.rb
--- old/yast2-firstboot-4.1.4/test/y2firstboot/clients/configuration_management_test.rb 2019-01-28 12:15:42.000000000 +0100
+++ new/yast2-firstboot-4.1.5/test/y2firstboot/clients/configuration_management_test.rb 2019-02-13 13:24:02.000000000 +0100
@@ -22,36 +22,41 @@
require_relative "../../test_helper"
require "y2firstboot/clients/configuration_management"
-require "configuration_management/configurators/salt"
+require "y2configuration_management/configurators/salt"
describe Y2Firstboot::Clients::ConfigurationManagement do
subject(:client) { described_class.new }
describe "#run" do
let(:provisioner) do
- instance_double(Yast::ConfigurationManagement::Clients::Provision, run: nil)
+ instance_double(Y2ConfigurationManagement::Clients::Provision, run: provision_result)
end
let(:configurator) do
instance_double(
- Yast::ConfigurationManagement::Configurators::Salt, prepare: true, packages: packages
+ Y2ConfigurationManagement::Configurators::Salt, prepare: :finish, packages: packages
)
end
let(:packages) { { "install" => ["salt"] } }
let(:settings) { { "states_roots" => ["/srv/salt"] } }
+ let(:provision_result) { true }
+ let(:going_back) { false }
before do
allow(Yast::ProductFeatures).to receive(:GetSection)
.with("configuration_management")
.and_return(settings)
- allow(Yast::ConfigurationManagement::Configurators::Base).to receive(:for)
+ allow(Y2ConfigurationManagement::Configurators::Base).to receive(:for)
.and_return(configurator)
- allow(Yast::ConfigurationManagement::Clients::Provision).to receive(:new)
+ allow(Y2ConfigurationManagement::Clients::Provision).to receive(:new)
.and_return(provisioner)
allow(Yast::PackageSystem).to receive(:CheckAndInstallPackages).and_return(true)
+ allow(Yast::GetInstArgs).to receive(:going_back).and_return(going_back)
+ Y2ConfigurationManagement::Configurations::Base.current = nil
+ Y2ConfigurationManagement::Configurators::Base.current = nil
end
it "uses the configuration from the control file" do
- expect(Yast::ConfigurationManagement::Configurators::Base).to receive(:for) do |config|
+ expect(Y2ConfigurationManagement::Configurators::Base).to receive(:for) do |config|
expect(config.states_roots).to include(Pathname.new("/srv/salt"))
configurator
end
@@ -69,15 +74,42 @@
client.run
end
- it "returns :auto" do
- expect(client.run).to eq(:auto)
+ it "returns :next" do
+ allow(provisioner).to receive(:run).and_return(:finish)
+ expect(client.run).to eq(:next)
+ end
+
+ context "when the provisioner fails" do
+ let(:provision_result) { false }
+
+ it "returns :abort" do
+ expect(client.run).to eq(:abort)
+ end
+ end
+
+ context "when going back" do
+ let(:going_back) { true }
+
+ before do
+ allow(configurator).to receive(:prepare).and_return(:back)
+ end
+
+ it "runs the configurator in reverse mode" do
+ expect(configurator).to receive(:prepare).with(reverse: true)
+ client.run
+ end
+
+ it "does not run the provisioner" do
+ expect(provisioner).to_not receive(:run)
+ client.run
+ end
end
context "when type or mode are specified in the configuration" do
let(:settings) { { "type" => "puppet", "mode" => "client" } }
it "forces type and mode" do
- expect(Yast::ConfigurationManagement::Configurators::Base).to receive(:for)
+ expect(Y2ConfigurationManagement::Configurators::Base).to receive(:for)
.with(an_object_having_attributes(type: "salt", mode: :masterless))
.and_return(configurator)
client.run
@@ -88,7 +120,7 @@
let(:settings) { {} }
it "uses the default configuration" do
- expect(Yast::ConfigurationManagement::Configurators::Base).to receive(:for)
+ expect(Y2ConfigurationManagement::Configurators::Base).to receive(:for)
.with(an_object_having_attributes(type: "salt")).and_return(configurator)
client.run
end