Hello community, here is the log from the commit of package yast2-services-manager for openSUSE:Factory checked in at 2017-01-27 10:40:13 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-services-manager (Old) and /work/SRC/openSUSE:Factory/.yast2-services-manager.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-services-manager" Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-services-manager/yast2-services-manager.changes 2016-11-19 12:49:20.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.yast2-services-manager.new/yast2-services-manager.changes 2017-02-03 20:07:54.222746105 +0100 @@ -1,0 +2,9 @@ +Thu Jan 19 17:10:47 CET 2017 - sch...@suse.de + +- Using systemctl calls (is-active, is-enabled) to evaluate if the + service is enabled/active (bnc#1017166, bnc#1012047) +- AY-Import: Filter out all YaST services which should e.g. not be + restarted while installation.(bnc#956043) +- 3.2.0 + +------------------------------------------------------------------- Old: ---- yast2-services-manager-3.1.43.tar.bz2 New: ---- yast2-services-manager-3.2.0.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-services-manager.spec ++++++ --- /var/tmp/diff_new_pack.zdBQp5/_old 2017-02-03 20:07:54.782667291 +0100 +++ /var/tmp/diff_new_pack.zdBQp5/_new 2017-02-03 20:07:54.786666729 +0100 @@ -1,7 +1,7 @@ # # spec file for package yast2-services-manager # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -24,7 +24,7 @@ ###################################################################### Name: yast2-services-manager -Version: 3.1.43 +Version: 3.2.0 Release: 0 BuildArch: noarch ++++++ yast2-services-manager-3.1.43.tar.bz2 -> yast2-services-manager-3.2.0.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-services-manager-3.1.43/.travis.yml new/yast2-services-manager-3.2.0/.travis.yml --- old/yast2-services-manager-3.1.43/.travis.yml 2016-11-16 16:20:47.153419423 +0100 +++ new/yast2-services-manager-3.2.0/.travis.yml 2017-01-24 16:50:48.456673328 +0100 @@ -1,15 +1,11 @@ -language: cpp -compiler: - - gcc +sudo: required +language: bash +services: + - docker + before_install: - # disable rvm, use system Ruby - - rvm reset - - wget https://raw.githubusercontent.com/yast/yast-devtools/master/travis-tools/travis_setup.sh - - sh ./travis_setup.sh -p "rake yast2 yast2-devtools" -g "rspec:3.3.0 yast-rake yard gettext" + - docker build -t yast-services-manager-image . script: - - rake check:syntax - - rake check:pot - - yardoc - - rake test:unit - - sudo rake install - + # the "yast-travis-ruby" script is included in the base yastdevel/ruby image + # see https://github.com/yast/docker-yast-ruby/blob/master/yast-travis-ruby + - docker run -it -e TRAVIS=1 -e TRAVIS_JOB_ID="$TRAVIS_JOB_ID" yast-services-manager-image yast-travis-ruby diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-services-manager-3.1.43/Dockerfile new/yast2-services-manager-3.2.0/Dockerfile --- old/yast2-services-manager-3.1.43/Dockerfile 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-services-manager-3.2.0/Dockerfile 2017-01-24 16:50:48.464673328 +0100 @@ -0,0 +1,3 @@ +FROM yastdevel/ruby +COPY . /usr/src/app + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-services-manager-3.1.43/package/yast2-services-manager.changes new/yast2-services-manager-3.2.0/package/yast2-services-manager.changes --- old/yast2-services-manager-3.1.43/package/yast2-services-manager.changes 2016-11-16 16:20:47.165419423 +0100 +++ new/yast2-services-manager-3.2.0/package/yast2-services-manager.changes 2017-01-24 16:50:48.476673328 +0100 @@ -1,4 +1,13 @@ ------------------------------------------------------------------- +Thu Jan 19 17:10:47 CET 2017 - sch...@suse.de + +- Using systemctl calls (is-active, is-enabled) to evaluate if the + service is enabled/active (bnc#1017166, bnc#1012047) +- AY-Import: Filter out all YaST services which should e.g. not be + restarted while installation.(bnc#956043) +- 3.2.0 + +------------------------------------------------------------------- Tue Nov 15 11:33:19 UTC 2016 - igonzalezs...@suse.com - Use the X-SuSE-YaST-AutoInstResourceAliases key to get rid diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-services-manager-3.1.43/package/yast2-services-manager.spec new/yast2-services-manager-3.2.0/package/yast2-services-manager.spec --- old/yast2-services-manager-3.1.43/package/yast2-services-manager.spec 2016-11-16 16:20:47.165419423 +0100 +++ new/yast2-services-manager-3.2.0/package/yast2-services-manager.spec 2017-01-24 16:50:48.480673328 +0100 @@ -24,7 +24,7 @@ ###################################################################### Name: yast2-services-manager -Version: 3.1.43 +Version: 3.2.0 Release: 0 BuildArch: noarch diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-services-manager-3.1.43/src/clients/services-manager.rb new/yast2-services-manager-3.2.0/src/clients/services-manager.rb --- old/yast2-services-manager-3.1.43/src/clients/services-manager.rb 2016-11-16 16:20:47.181419423 +0100 +++ new/yast2-services-manager-3.2.0/src/clients/services-manager.rb 2017-01-24 16:50:48.500673328 +0100 @@ -181,7 +181,6 @@ def redraw_service(service) enabled = ServicesManagerService.enabled(service) - UI.ChangeWidget( Id(Id::SERVICES_TABLE), Cell(service, 1), @@ -253,8 +252,11 @@ def toggle_service service = UI.QueryWidget(Id(Id::SERVICES_TABLE), :CurrentItem) Builtins.y2milestone('Toggling service status: %1', service) - ServicesManagerService.toggle(service) - + if ServicesManagerService.can_be_enabled(service) + ServicesManagerService.toggle(service) + else + Popup.Error(_("This service cannot be enabled/disabled because it has no \"install\" section in the description file")) + end redraw_service(service) UI.SetFocus(Id(Id::SERVICES_TABLE)) true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-services-manager-3.1.43/src/lib/services-manager/services_manager_profile.rb new/yast2-services-manager-3.2.0/src/lib/services-manager/services_manager_profile.rb --- old/yast2-services-manager-3.1.43/src/lib/services-manager/services_manager_profile.rb 2016-11-16 16:20:47.209419423 +0100 +++ new/yast2-services-manager-3.2.0/src/lib/services-manager/services_manager_profile.rb 2017-01-24 16:50:48.524673328 +0100 @@ -62,6 +62,8 @@ ENABLE = 'enable' DISABLE = 'disable' + YAST_SERVICES = ["YaST2-Firstboot", "YaST2-Second-Stage"] + # Service object with two attributes: # @attr [String] name of the service unit. Suffix '.service' is optional. # @attr [String] required status on the target system. Can be 'enable' or 'disable'. @@ -103,6 +105,7 @@ Yast::Report.Error _("Unknown autoyast services profile schema for 'services-manager'") return end + reject_yast_services log.info "Extracted services from autoyast profile: #{self.services}" end @@ -128,6 +131,11 @@ end end + # Filter out all YaST services + def reject_yast_services + self.services.reject! {|s| YAST_SERVICES.include?(s.name)} + end + def load_from_simple_list services self.services.concat( services.map {|service_name| Service.new(service_name, ENABLE)} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-services-manager-3.1.43/src/modules/services_manager_service.rb new/yast2-services-manager-3.2.0/src/modules/services_manager_service.rb --- old/yast2-services-manager-3.1.43/src/modules/services_manager_service.rb 2016-11-16 16:20:47.221419423 +0100 +++ new/yast2-services-manager-3.2.0/src/modules/services_manager_service.rb 2017-01-24 16:50:48.544673328 +0100 @@ -11,27 +11,25 @@ LIST_UNIT_FILES_COMMAND = 'systemctl list-unit-files --type service' LIST_UNITS_COMMAND = 'systemctl list-units --all --type service' STATUS_COMMAND = 'systemctl status' + IS_ACTIVE_COMMAND = 'systemctl is-active' COMMAND_OPTIONS = ' --no-legend --no-pager --no-ask-password ' TERM_OPTIONS = ' LANG=C TERM=dumb COLUMNS=1024 ' SERVICE_SUFFIX = '.service' DEFAULT_SERVICE_SETTINGS = { - :enabled => false, # Whether the service has been enabled - :modified => false, # Whether the service has been changed (got enabled/disabled) - :active => false, # The high-level unit activation state, i.e. generalization of SUB - :loaded => false, # Reflects whether the unit definition was properly loaded - :description => nil # English description of the service + :enabled => false, # Whether the service has been enabled + :can_be_enabled => true, # Whether the service can be enabled/disabled by the user + :modified => false, # Whether the service has been changed (got enabled/disabled) + :active => false, # The high-level unit activation state, i.e. generalization of SUB + :loaded => false, # Reflects whether the unit definition was properly loaded + :description => nil # English description of the service } module Status LOADED = 'loaded' - ACTIVE = 'active' - ACTIVATING = 'activating' - RELOADING = 'reloading' - INACTIVE = 'inactive' - ENABLED = 'enabled' - DISABLED = 'disabled' - SUPPORTED_STATES = [ENABLED, DISABLED] + NOTFOUND = 'not-found' + MASKED = 'masked' # The service has been marked as completely unstartable, automatically or manually. + STATIC = 'static' # The service is missing the [Install] section in its init script, so you cannot enable or disable it. end class ServiceLoader @@ -47,16 +45,14 @@ load_units @supported_unit_files = unit_files.select do |_, status| - Status::SUPPORTED_STATES.member?(status) + status != Status::MASKED # masked services should not been shown at all end - @supported_units = units.reject do |name, _| - unit_files[name] && !Status::SUPPORTED_STATES.member?(unit_files[name]) + @supported_units = units.reject do |name, attributes| + attributes[:status] == Status::NOTFOUND # definition file is not available anymore end - supported_units.select! { |_, attributes| attributes[:status] == Status::LOADED } - extract_services_from_units - extract_services_from_unit_files + extract_services services end @@ -72,6 +68,18 @@ SCR.Execute(Path.new('.target.bash_output'), command) end + # Checking if a service is active or not. + # + # @param service [String] Service name + # @return [Boolean] is it active or not + def is_active?(service) + # There is a active? method in SystemdUnit class but it checks the status + # active and activating only. Not sure if this correct. So we are taking the + # official call of systemctl command. + command = "#{TERM_OPTIONS}#{IS_ACTIVE_COMMAND} #{service}#{SERVICE_SUFFIX} 2>&1" + SCR.Execute(Path.new('.target.bash_output'), command)["exit"] == 0 + end + def load_unit_files list_unit_files['stdout'].each_line do |line| service, status = line.split(/[\s]+/) @@ -86,38 +94,47 @@ service.chomp! SERVICE_SUFFIX units[service] = { :status => status, - # bsc#956043 service can be 'just being activated' or 'reloaded' - # See https://github.com/systemd/systemd/blob/7152869f0a4a4612022244064cc2b3905b1e3fc7/src/basic/unit-name.c#L844 - :active => ( - active == Status::ACTIVE || - active == Status::ACTIVATING || - active == Status::RELOADING - ), :description => description.join(' ') } end end def extract_services_from_unit_files - supported_unit_files.each do |name, status| - next if services[name] + @supported_unit_files.each do |name, status| services[name] = DEFAULT_SERVICE_SETTINGS.clone - services[name][:enabled] = status == Status::ENABLED - services[name][:active] = Yast::Service.Status(name).zero? + if @supported_units[name] + # Services are loaded into the system. Taking that one because there are more + # information + services[name][:loaded] = @supported_units[name][:status] == Status::LOADED + services[name][:description] = @supported_units[name][:description] + end + services[name][:can_be_enabled] = status == Status::STATIC ? false : true end end def extract_services_from_units - supported_units.each do |name, attributes| + @supported_units.each do |name, service| + next if services[name] services[name] = DEFAULT_SERVICE_SETTINGS.clone - if supported_unit_files[name] - services[name][:enabled] = supported_unit_files[name] == Status::ENABLED - else - services[name][:enabled] = Yast::Service.Enabled(name) + services[name][:loaded] = service[:status] == Status::LOADED + services[name][:description] = service[:description] + end + end + + def extract_services + extract_services_from_unit_files + # Add old LSB services (Services which are loaded but not available as a unit file) + extract_services_from_units + + # Rest of settings + services.each_key do |name| + services[name][:enabled] = Yast::Service.Enabled(name) + services[name][:active] = is_active?(name) + if !services[name][:description] || services[name][:description].empty? + # Trying to evaluate description via the show command of systemctl + s = SystemdService.find(name) + services[name][:description] = SystemdService.find(name).description if s end - services[name][:loaded] = attributes[:status] == Status::LOADED - services[name][:active] = attributes[:active] - services[name][:description] = attributes[:description] end end end @@ -143,7 +160,7 @@ # # @param String service name # @param Boolean running - def activate service + def activate(service) exists?(service) do services[service][:active] = true Builtins.y2milestone "Service #{service} has been marked for activation" @@ -156,7 +173,7 @@ # # @param String service name # @param Boolean running - def deactivate service + def deactivate(service) exists?(service) do services[service][:active] = false services[service][:modified] = true @@ -168,7 +185,7 @@ # # @param String service name # @return Boolean running - def active service + def active(service) exists?(service) { services[service][:active] } end @@ -178,7 +195,7 @@ # # @param String service name # @param Boolean new service status - def enable service + def enable(service) exists?(service) do services[service][:enabled] = true services[service][:modified] = true @@ -190,7 +207,7 @@ # # @param String service name # @param Boolean new service status - def disable service + def disable(service) exists?(service) do services[service][:enabled] = false services[service][:modified] = true @@ -202,15 +219,25 @@ # # @param String service # @return Boolean enabled - def enabled service + def enabled(service) exists?(service) do services[service][:enabled] end end + # Returns whether the given service can be enabled/disabled by the user + # + # @param service [String] Service name + # @return [Boolean] is it enabled or not + def can_be_enabled(service) + exists?(service) do + services[service][:can_be_enabled] + end + end + # Change the global modified status # Reverting modified to false also requires to set the flag for all services - def modified= required_status + def modified=(required_status) reload if required_status == false @modified = required_status end @@ -245,7 +272,7 @@ # Returns only enabled services, the rest is expected to be disabled def export enabled_services = services.select do |service_name, properties| - enabled(service_name) && properties[:loaded] + enabled(service_name) && properties[:loaded] && can_be_enabled(service_name) end # Only services modifed by the user to be disabled are exported @@ -265,7 +292,7 @@ } end - def import profile + def import(profile) log.info "List of services from autoyast profile: #{profile.services.map(&:name)}" non_existent_services = [] @@ -328,7 +355,7 @@ # # @param [String] service name # @return [Boolean] - def switch service + def switch(service) active(service) ? deactivate(service) : activate(service) end @@ -336,7 +363,7 @@ # # @param [String] service name # @return [Boolean] - def switch! service_name + def switch!(service_name) if active(service_name) Yast::Service.Start(service_name) else @@ -344,7 +371,7 @@ end end - def reset_service service + def reset_service(service) services[service][:modified] = false end @@ -352,7 +379,7 @@ # # @param [String] service name # @return [Boolean] - def toggle service + def toggle(service) enabled(service) ? disable(service) : enable(service) end @@ -360,7 +387,7 @@ # # @param [String] service name # @return [Boolean] - def toggle! service + def toggle!(service) enabled(service) ? Yast::Service.Enable(service) : Yast::Service.Disable(service) end @@ -368,7 +395,7 @@ # # @param String service name # @return String full unformatted information - def status service + def status(service) command = "#{TERM_OPTIONS}#{STATUS_COMMAND} #{service}#{SERVICE_SUFFIX} 2>&1" SCR.Execute(path('.target.bash_output'), command)['stdout'] end @@ -381,7 +408,7 @@ # # @params [String] service name # @return [Boolean] - def exists? service + def exists?(service) exists = !!services[service] if exists && block_given? yield @@ -441,21 +468,22 @@ services_toggled end - publish({:function => :active, :type => "boolean ()" }) - publish({:function => :activate, :type => "string (boolean)" }) - publish({:function => :all, :type => "map <string, map> ()" }) - publish({:function => :disable, :type => "string (boolean)" }) - publish({:function => :enable, :type => "string (boolean)" }) - publish({:function => :enabled, :type => "boolean ()" }) - publish({:function => :errors, :type => "list ()" }) - publish({:function => :export, :type => "list <string> ()" }) - publish({:function => :import, :type => "boolean (list <string>)" }) - publish({:function => :modified, :type => "boolean ()" }) - publish({:function => :modified=, :type => "boolean (boolean)" }) - publish({:function => :read, :type => "map <string, map> ()" }) - publish({:function => :reset, :type => "boolean ()" }) - publish({:function => :save, :type => "boolean ()" }) - publish({:function => :status, :type => "string (string)" }) + publish({:function => :active, :type => "boolean ()" }) + publish({:function => :activate, :type => "string (boolean)" }) + publish({:function => :all, :type => "map <string, map> ()" }) + publish({:function => :disable, :type => "string (boolean)" }) + publish({:function => :enable, :type => "string (boolean)" }) + publish({:function => :enabled, :type => "boolean ()" }) + publish({:function => :can_be_enabled, :type => "boolean ()" }) + publish({:function => :errors, :type => "list ()" }) + publish({:function => :export, :type => "list <string> ()" }) + publish({:function => :import, :type => "boolean (list <string>)" }) + publish({:function => :modified, :type => "boolean ()" }) + publish({:function => :modified=, :type => "boolean (boolean)" }) + publish({:function => :read, :type => "map <string, map> ()" }) + publish({:function => :reset, :type => "boolean ()" }) + publish({:function => :save, :type => "boolean ()" }) + publish({:function => :status, :type => "string (string)" }) end ServicesManagerService = ServicesManagerServiceClass.new diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-services-manager-3.1.43/test/services_manager_service_test.rb new/yast2-services-manager-3.2.0/test/services_manager_service_test.rb --- old/yast2-services-manager-3.1.43/test/services_manager_service_test.rb 2016-11-16 16:20:47.225419423 +0100 +++ new/yast2-services-manager-3.2.0/test/services_manager_service_test.rb 2017-01-24 16:50:48.564673328 +0100 @@ -14,28 +14,39 @@ allow(Service).to receive(:Disable).and_return true allow(Service).to receive(:Start).and_return true allow(Service).to receive(:Stop).and_return true + allow(Service).to receive(:Enabled).with("sshd").and_return true + allow(Service).to receive(:Enabled).with("postfix").and_return false + allow(Service).to receive(:Enabled).with("swap").and_return false + allow(Service).to receive(:Enabled).with("dbus").and_return false + allow(Service).to receive(:Enabled).with("notloaded").and_return false + allow(Service).to receive(:Enabled).with("xbus").and_return true + allow(Service).to receive(:Enabled).with("ybus").and_return true + allow(Service).to receive(:Enabled).with("zbus").and_return true + allow(Service).to receive(:Enabled).with("lsb").and_return false + allow(Service).to receive(:Enabled).with("").and_return true + end before do - ServicesManagerServiceClass::ServiceLoader.any_instance - .stub(:list_unit_files) + allow_any_instance_of(ServicesManagerServiceClass::ServiceLoader).to receive(:list_unit_files) .and_return({ - 'stdout'=> "sshd.service enabled \n" + - "postfix.service disabled\n " + - "swap.service masked \n" + - "dbus.service static \n" + - "xbus.service enabled \n" + - "ybus.service enabled \n" + - "zbus.service enabled \n", + 'stdout'=> "sshd.service enabled \n" + + "postfix.service disabled\n " + + "swap.service masked \n" + + "dbus.service static \n" + + "notloaded.service static \n" + + "xbus.service enabled \n" + + "ybus.service enabled \n" + + "zbus.service enabled \n", 'stderr' => '', 'exit' => 0 }) - ServicesManagerServiceClass::ServiceLoader.any_instance - .stub(:list_units) + allow_any_instance_of(ServicesManagerServiceClass::ServiceLoader).to receive(:list_units) .and_return({ 'stdout'=>"sshd.service loaded active running OpenSSH Daemon\n" + "postfix.service loaded inactive dead Postfix Mail Agent\n" + "dbus.service loaded active running D-Bus System Message Bus\n" + + "lsb.service loaded active running LSB service\n" + "xbus.service loaded activating start start YaST2 Second Stage (1)\n" + "ybus.service loaded deactivating stop start YaST2 Second Stage (2)\n" + "zbus.service loaded reloading stop start YaST2 Second Stage (3)\n", @@ -43,14 +54,20 @@ 'exit' => 0 }) + allow_any_instance_of(ServicesManagerServiceClass::ServiceLoader).to receive(:is_active?).and_return true + @service = Yast::ServicesManagerServiceClass.new end it "provides a collection of supported services" do expect(service.modified).to eq(false) expect(service.all).not_to be_empty - expect(service.all.keys).to include('sshd', 'postfix') - expect(service.all).not_to include('swap', 'dbus') + expect(service.all.keys).to include('sshd', 'postfix', 'notloaded', 'lsb') + expect(service.all).not_to include('swap') + end + + it "cannot enable services which have the status -static-" do + expect(service.can_be_enabled("dbus")).to eq(false) end it "can enable a service which is disabled" do @@ -82,7 +99,6 @@ it "can start an inactive service" do stub_services postfix = service.all['postfix'] - expect(postfix[:active]).to be(false) expect(postfix[:modified]).to be(false) service.activate 'postfix' expect(postfix[:active]).to be(true) @@ -173,22 +189,6 @@ end end - context "when service is in state 'activating'" do - it "is considered to be active" do - stub_services - xbus_service = service.all['xbus'] - expect(xbus_service[:active]).to eq(true) - end - end - - context "when service is in state 'deactivating'" do - it "is considered to be inactive" do - stub_services - ybus_service = service.all['ybus'] - expect(ybus_service[:active]).to eq(false) - end - end - context "when service is in state 'reloading'" do it "is considered to be active" do stub_services diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-services-manager-3.1.43/test/services_manager_test.rb new/yast2-services-manager-3.2.0/test/services_manager_test.rb --- old/yast2-services-manager-3.1.43/test/services_manager_test.rb 2016-11-16 16:20:47.241419423 +0100 +++ new/yast2-services-manager-3.2.0/test/services_manager_test.rb 2017-01-24 16:50:48.564673328 +0100 @@ -44,13 +44,13 @@ context "Autoyast API" do it "exports systemd target and services" do services = { - 'a' => { :enabled => true, :loaded => true }, - 'b' => { :enabled => false, :modified => true }, - 'c' => { :enabled => true, :loaded => true }, + 'a' => { :enabled => true, :loaded => true, :can_be_enabled => true }, + 'b' => { :enabled => false, :modified => true, :can_be_enabled => true }, + 'c' => { :enabled => true, :loaded => true, :can_be_enabled => true }, # Service will not be exported: it's not modified - 'd' => { :enabled => false, :modified => false }, + 'd' => { :enabled => false, :modified => false, :can_be_enabled => true }, # Service will not be exported: it's not loaded - 'e' => { :enabled => true, :loaded => false }, + 'e' => { :enabled => true, :loaded => false, :can_be_enabled => true }, } # Services set during installation @@ -82,6 +82,16 @@ 'service_start' => '3', }, { + 'service_name' => 'YaST2-Second-Stage', + 'service_status' => 'enable', + 'service_start' => '3', + }, + { + 'service_name' => 'YaST2-Firstboot', + 'service_status' => 'enable', + 'service_start' => '3', + }, + { 'service_name' => 'sc', 'service_status' => 'disable', 'service_start' => '3', @@ -91,6 +101,8 @@ expect(ServicesManagerService).to receive(:exists?).with(/^s[abc]$/).at_least(:once).and_return(true) expect(ServicesManagerService).to receive(:enable).with(/^s[ab]$/).twice.and_return(true) + expect(ServicesManagerService).not_to receive(:enable).with("YaST2-Second-Stage") + expect(ServicesManagerService).not_to receive(:enable).with("YaST2-Firstboot") expect(ServicesManagerService).to receive(:disable).with(/^sc$/).once.and_return(true) expect(ServicesManagerService).to receive(:import).and_call_original @@ -177,12 +189,14 @@ data = { 'default_target' => 'multi-user', 'services' => { - 'enable' => ['x', 'y', 'z'], + 'enable' => ['x', 'y', 'z', "YaST2-Firstboot", "YaST2-Second-Stage"], 'disable' => ['d', 'e', 'f'], }, } expect(ServicesManagerService).to receive(:exists?).with(/^[xyzdef]$/).at_least(:once).and_return(true) expect(ServicesManagerService).to receive(:enable).with(/^[xyz]$/).exactly(3).times.and_return(true) + expect(ServicesManagerService).not_to receive(:enable).with("YaST2-Second-Stage") + expect(ServicesManagerService).not_to receive(:enable).with("YaST2-Firstboot") expect(ServicesManagerService).to receive(:disable).with(/^[def]$/).exactly(3).times.and_return(true) expect(ServicesManagerService).to receive(:import).and_call_original