[yast-commit] [ci_new_pac] JFYI yast2 -> sle12
Script 'mail_helper' called by ro Hello packager, This is just FYI. Your package was checked in in distribution "sle12" by autobuild-member: ro. Here comes the log... ---------------------------%<------------------------------ Hi, here is the log from ci_new_pac /mounts/work_src_done/SLE12/yast2 -> sle12 ## BNC# 853300 : "yast2 iscsi-client can not automatically login" (ASSIGNED/) Changes: -------- --- /work/SRC/SUSE:SLE-12:GA/yast2/yast2.changes 2014-03-04 17:51:12.000000000 +0100 +++ /mounts/work_src_done/SLE12/yast2/yast2.changes 2014-03-07 10:42:14.000000000 +0100 @@ -1,0 +2,13 @@ +Thu Mar 6 15:21:44 UTC 2014 - vmoravec@suse.com + +- Allow raising exceptions for not found systemd units; + updates the expectations for bnc#853300 +- 3.1.23 + +------------------------------------------------------------------- +Thu Mar 6 07:48:29 UTC 2014 - vmoravec@suse.com + +- Add systemd service support; needed by fate#314946 +- 3.1.22 + +------------------------------------------------------------------- calling whatdependson for sle12-i586 Packages directly triggered for rebuild: - yast2 - at least 73 other packages ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/SUSE:SLE-12:GA/yast2 (Old) and /mounts/work_src_done/SLE12/yast2 (BS:build ID:34035 MAIL:yast-commit@opensuse.org) (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "yast2", Maintainer is "yast-commit@opensuse.org" Old: ---- yast2-3.1.21.tar.bz2 New: ---- yast2-3.1.23.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2.spec ++++++ --- /var/tmp/diff_new_pack.iHlwF3/_old 2014-03-07 17:10:31.000000000 +0100 +++ /var/tmp/diff_new_pack.iHlwF3/_new 2014-03-07 17:10:31.000000000 +0100 @@ -17,7 +17,7 @@ Name: yast2 -Version: 3.1.21 +Version: 3.1.23 Release: 0 URL: https://github.com/yast/yast-yast2 ++++++ yast2-3.1.21.tar.bz2 -> yast2-3.1.23.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.21/library/systemd/src/lib/yast2/systemctl.rb new/yast2-3.1.23/library/systemd/src/lib/yast2/systemctl.rb --- old/yast2-3.1.21/library/systemd/src/lib/yast2/systemctl.rb 2014-03-04 16:41:14.000000000 +0100 +++ new/yast2-3.1.23/library/systemd/src/lib/yast2/systemctl.rb 2014-03-07 10:34:47.000000000 +0100 @@ -15,16 +15,28 @@ def socket_units sockets_from_files = list_unit_files(:type=>:socket).lines.map do |line| - line[/\S+/] + first_column(line) end sockets_from_units = list_units(:type=>:socket).lines.map do |line| - line[/\S+/] + first_column(line) end ( sockets_from_files | sockets_from_units ).compact end + def service_units + services_from_files = list_unit_files(:type=>:service).lines.map do |line| + first_column(line) + end + + services_from_units = list_units(:type=>:service).lines.map do |line| + first_column(line) + end + + ( services_from_files | services_from_units ).compact + end + private def list_unit_files type: nil @@ -39,6 +51,10 @@ command << " --type=#{type} " if type execute(command).stdout end + + def first_column line + line[/\S+/] + end end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.21/library/systemd/src/lib/yast2/systemd_unit.rb new/yast2-3.1.23/library/systemd/src/lib/yast2/systemd_unit.rb --- old/yast2-3.1.21/library/systemd/src/lib/yast2/systemd_unit.rb 2014-03-04 16:41:14.000000000 +0100 +++ new/yast2-3.1.23/library/systemd/src/lib/yast2/systemd_unit.rb 2014-03-07 10:34:47.000000000 +0100 @@ -51,8 +51,7 @@ extend Forwardable - def_delegators :@properties, :id, :path, - :active?, :enabled?, :running?, :loaded? + def_delegators :@properties, :id, :path, :description, :active?, :enabled?, :loaded? attr_reader :unit_name, :unit_type, :input_properties, :errors, :properties diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.21/library/systemd/src/modules/systemd_service.rb new/yast2-3.1.23/library/systemd/src/modules/systemd_service.rb --- old/yast2-3.1.21/library/systemd/src/modules/systemd_service.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-3.1.23/library/systemd/src/modules/systemd_service.rb 2014-03-07 10:34:47.000000000 +0100 @@ -0,0 +1,105 @@ +require 'yast2/systemd_unit' + +module Yast + ### + # Systemd.service unit control API + # + # @example How to use it in other yast libraries + # + # require 'yast' + # + # Yast.import 'SystemdService' + # + # ## Get a service unit by its name + # ## If the service unit can't be found, you'll get nil + # + # service = Yast::SystemdService.find('sshd') # service unit object + # + # # or using the full unit id 'sshd.service' + # + # service = Yast::SystemdService.find('sshd.service') + # + # ## If you can't handle any nil at the place of calling, + # ## use the finder with exclamation mark; + # ## SystemdServiceNotFound exception will be raised + # + # service = Yast::SystemdService.find!('IcanHasMoar') # SystemdServiceNotFound: Service unit 'IcanHasMoar' not found + # + # ## Get basic unit properties + # + # service.unit_name # 'sshd' + # service.unit_type # 'service' + # service.id # 'sshd.service' + # service.description # 'OpenSSH Daemon' + # service.path # '/usr/lib/systemd/system/sshd.service' + # service.loaded? # true if it's loaded, false otherwise + # service.running? # true if it's active and running + # service.enabled? # true if enabled, false otherwise + # service.disabled? # true if disabled, false otherwise + # service.status # the same text output you get with `systemctl status sshd.service` + # service.show # equivalent of calling `systemctl show sshd.service` + # + # ## Service unit file commands + # + # # Unit file commands do modifications on the service unit. Calling them triggers + # # service properties reloading. If a command fails, the error message is available + # # through the method #errors as a string. + # + # service.start # true if unit has been activated successfully + # service.stop # true if unit has been deactivated successfully + # service.enable # true if unit has been enabled successfully + # service.disable # true if unit has been disabled successfully + # service.errors # error string available if some of the actions above fails + # + # ## Extended service properties + # + # # In case you need more details about the service unit than the default ones, + # # you can extend the parameters for .find method. Those properties are + # # then available on the service unit object under the #properties instance method. + # # An extended property is always a string, you must convert it manually, + # # no automatical casting is done by yast. + # # To get an overview of available service properties, try e.g., `systemctl show sshd.service` + # + # service = Yast::SystemdService.find('sshd', :type=>'Type') + # service.properties.type # 'simple' + # + ## + + class SystemdServiceNotFound < StandardError + def initialize service_name + super "Service unit '#{service_name}' not found" + end + end + + class SystemdServiceClass < Module + UNIT_SUFFIX = ".service" + + def find service_name, properties={} + service_name << UNIT_SUFFIX unless service_name.end_with?(UNIT_SUFFIX) + service = Service.new(service_name, properties) + return nil if service.properties.not_found? + service + end + + def find! service_name, properties={} + find(service_name, properties) || raise(SystemdServiceNotFound, service_name) + end + + def all properties={} + services = Systemctl.service_units.map do |service_unit| + Service.new(service_unit, properties) + end + end + + class Service < SystemdUnit + def pid + properties.pid + end + + def running? + properties.running? + end + end + end + SystemdService = SystemdServiceClass.new +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.21/library/systemd/src/modules/systemd_socket.rb new/yast2-3.1.23/library/systemd/src/modules/systemd_socket.rb --- old/yast2-3.1.21/library/systemd/src/modules/systemd_socket.rb 2014-03-04 16:41:14.000000000 +0100 +++ new/yast2-3.1.23/library/systemd/src/modules/systemd_socket.rb 2014-03-07 10:34:47.000000000 +0100 @@ -11,8 +11,15 @@ # Yast.import 'SystemdSocket' # # ## Get a socket unit by its name + # ## If the socket unit can't be found, you'll get a nil object # - # socket = Yast::SystemdSocket.find('iscsid') + # socket = Yast::SystemdSocket.find('iscsid') # socket unit object + # + # ## If you can't handle any nil at the place of calling, + # ## use the finder with exclamation mark; + # ## SystemdSocketNotFound exception will be raised + # + # socket = Yast::SystemdSocket.find!('IcanHasCheez') # SystemdSocketNotFound: Socket unit 'IcanHasCheez' not found # # ## Get basic unit properties # @@ -52,6 +59,12 @@ # ## + class SystemdSocketNotFound < StandardError + def initialize socket_name + super "Socket unit '#{socket_name}' not found" + end + end + class SystemdSocketClass < Module UNIT_SUFFIX = ".socket" @@ -62,6 +75,10 @@ socket end + def find! socket_name, properties={} + find(socket_name, properties) || raise(SystemdSocketNotFound, socket_name) + end + def all properties={} sockets = Systemctl.socket_units.map do |socket_unit| Socket.new(socket_unit, properties) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.21/library/systemd/test/data/sshd_service_properties new/yast2-3.1.23/library/systemd/test/data/sshd_service_properties --- old/yast2-3.1.21/library/systemd/test/data/sshd_service_properties 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-3.1.23/library/systemd/test/data/sshd_service_properties 2014-03-07 10:34:47.000000000 +0100 @@ -0,0 +1,120 @@ +Id=sshd.service +Names=sshd.service +Requires=basic.target +Wants=system.slice +WantedBy=multi-user.target +Conflicts=shutdown.target +Before=shutdown.target multi-user.target +After=network.target systemd-journald.socket basic.target system.slice +Description=OpenSSH Daemon +LoadState=loaded +ActiveState=active +SubState=running +FragmentPath=/usr/lib/systemd/system/sshd.service +UnitFileState=enabled +InactiveExitTimestamp=St 2014-02-12 15:22:46 CET +InactiveExitTimestampMonotonic=22172625 +ActiveEnterTimestamp=St 2014-02-12 15:22:46 CET +ActiveEnterTimestampMonotonic=22184649 +ActiveExitTimestampMonotonic=0 +InactiveEnterTimestampMonotonic=0 +CanStart=yes +CanStop=yes +CanReload=yes +CanIsolate=no +StopWhenUnneeded=no +RefuseManualStart=no +RefuseManualStop=no +AllowIsolate=no +DefaultDependencies=yes +OnFailureIsolate=no +IgnoreOnIsolate=no +IgnoreOnSnapshot=no +NeedDaemonReload=no +JobTimeoutUSec=0 +ConditionTimestamp=St 2014-02-12 15:22:46 CET +ConditionTimestampMonotonic=22169870 +ConditionResult=yes +Transient=no +Slice=system.slice +ControlGroup=/system.slice/sshd.service +Type=simple +Restart=always +NotifyAccess=none +RestartUSec=100ms +TimeoutStartUSec=1min 30s +TimeoutStopUSec=1min 30s +WatchdogUSec=0 +WatchdogTimestampMonotonic=0 +StartLimitInterval=10000000 +StartLimitBurst=5 +StartLimitAction=none +ExecStartPre={ path=/usr/sbin/sshd-gen-keys-start ; argv[]=/usr/sbin/sshd-gen-keys-start ; ignore_errors=no ; start_time=[n/a] ; stop_time=[n/a] ; pid=0 ; code=(null) ; status=0/0 } +ExecStart={ path=/usr/sbin/sshd ; argv[]=/usr/sbin/sshd -D $SSHD_OPTS ; ignore_errors=no ; start_time=[n/a] ; stop_time=[n/a] ; pid=0 ; code=(null) ; status=0/0 } +ExecReload={ path=/bin/kill ; argv[]=/bin/kill -HUP $MAINPID ; ignore_errors=no ; start_time=[n/a] ; stop_time=[n/a] ; pid=0 ; code=(null) ; status=0/0 } +PermissionsStartOnly=no +RootDirectoryStartOnly=no +RemainAfterExit=no +GuessMainPID=yes +MainPID=2708 +ControlPID=0 +Result=success +EnvironmentFile=/etc/sysconfig/ssh (ignore_errors=no) +UMask=0022 +LimitCPU=18446744073709551615 +LimitFSIZE=18446744073709551615 +LimitDATA=18446744073709551615 +LimitSTACK=18446744073709551615 +LimitCORE=18446744073709551615 +LimitRSS=18446744073709551615 +LimitNOFILE=4096 +LimitAS=18446744073709551615 +LimitNPROC=7770 +LimitMEMLOCK=65536 +LimitLOCKS=18446744073709551615 +LimitSIGPENDING=7770 +LimitMSGQUEUE=819200 +LimitNICE=0 +LimitRTPRIO=0 +LimitRTTIME=18446744073709551615 +OOMScoreAdjust=0 +Nice=0 +IOScheduling=0 +CPUSchedulingPolicy=0 +CPUSchedulingPriority=0 +TimerSlackNSec=50000 +CPUSchedulingResetOnFork=no +NonBlocking=no +StandardInput=null +StandardOutput=journal +StandardError=inherit +TTYReset=no +TTYVHangup=no +TTYVTDisallocate=no +SyslogPriority=30 +SyslogLevelPrefix=yes +SecureBits=0 +CapabilityBoundingSet=18446744073709551615 +MountFlags=0 +PrivateTmp=no +PrivateNetwork=no +SameProcessGroup=no +IgnoreSIGPIPE=yes +NoNewPrivileges=no +KillMode=process +KillSignal=15 +SendSIGKILL=yes +SendSIGHUP=no +CPUAccounting=no +CPUShares=1024 +BlockIOAccounting=no +BlockIOWeight=1000 +MemoryAccounting=no +MemoryLimit=18446744073709551615 +DevicePolicy=auto +ExecMainStartTimestamp=St 2014-02-12 15:22:46 CET +ExecMainStartTimestampMonotonic=22184611 +ExecMainExitTimestampMonotonic=0 +ExecMainPID=2708 +ExecMainCode=0 +ExecMainStatus=0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.21/library/systemd/test/data/unknown_service_properties new/yast2-3.1.23/library/systemd/test/data/unknown_service_properties --- old/yast2-3.1.21/library/systemd/test/data/unknown_service_properties 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-3.1.23/library/systemd/test/data/unknown_service_properties 2014-03-07 10:34:47.000000000 +0100 @@ -0,0 +1,102 @@ +Id=unknown.service +Names=unknown.service +Description=unknown.service +LoadState=not-found +ActiveState=inactive +SubState=dead +InactiveExitTimestampMonotonic=0 +ActiveEnterTimestampMonotonic=0 +ActiveExitTimestampMonotonic=0 +InactiveEnterTimestampMonotonic=0 +CanStart=yes +CanStop=yes +CanReload=no +CanIsolate=no +StopWhenUnneeded=no +RefuseManualStart=no +RefuseManualStop=no +AllowIsolate=no +DefaultDependencies=yes +OnFailureIsolate=no +IgnoreOnIsolate=no +IgnoreOnSnapshot=no +NeedDaemonReload=no +JobTimeoutUSec=0 +ConditionTimestampMonotonic=0 +ConditionResult=no +LoadError=org.freedesktop.DBus.Error.FileNotFound "No such file or directory" +Transient=no +Restart=no +NotifyAccess=none +RestartUSec=100ms +TimeoutStartUSec=1min 30s +TimeoutStopUSec=1min 30s +WatchdogUSec=0 +WatchdogTimestampMonotonic=0 +StartLimitInterval=10000000 +StartLimitBurst=5 +StartLimitAction=none +PermissionsStartOnly=no +RootDirectoryStartOnly=no +RemainAfterExit=no +GuessMainPID=yes +MainPID=0 +ControlPID=0 +Result=success +UMask=0022 +LimitCPU=18446744073709551615 +LimitFSIZE=18446744073709551615 +LimitDATA=18446744073709551615 +LimitSTACK=18446744073709551615 +LimitCORE=18446744073709551615 +LimitRSS=18446744073709551615 +LimitNOFILE=65536 +LimitAS=18446744073709551615 +LimitNPROC=7770 +LimitMEMLOCK=65536 +LimitLOCKS=18446744073709551615 +LimitSIGPENDING=7770 +LimitMSGQUEUE=819200 +LimitNICE=0 +LimitRTPRIO=0 +LimitRTTIME=18446744073709551615 +OOMScoreAdjust=0 +Nice=0 +IOScheduling=0 +CPUSchedulingPolicy=0 +CPUSchedulingPriority=0 +TimerSlackNSec=50000 +CPUSchedulingResetOnFork=no +NonBlocking=no +StandardInput=null +StandardOutput=inherit +StandardError=inherit +TTYReset=no +TTYVHangup=no +TTYVTDisallocate=no +SyslogPriority=30 +SyslogLevelPrefix=yes +SecureBits=0 +CapabilityBoundingSet=18446744073709551615 +MountFlags=0 +PrivateTmp=no +PrivateNetwork=no +SameProcessGroup=no +IgnoreSIGPIPE=yes +NoNewPrivileges=no +KillMode=control-group +KillSignal=15 +SendSIGKILL=yes +SendSIGHUP=no +CPUAccounting=no +CPUShares=1024 +BlockIOAccounting=no +BlockIOWeight=1000 +MemoryAccounting=no +MemoryLimit=18446744073709551615 +DevicePolicy=auto +ExecMainStartTimestampMonotonic=0 +ExecMainExitTimestampMonotonic=0 +ExecMainPID=0 +ExecMainCode=0 +ExecMainStatus=0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.21/library/systemd/test/data/unknown_socket_properties new/yast2-3.1.23/library/systemd/test/data/unknown_socket_properties --- old/yast2-3.1.21/library/systemd/test/data/unknown_socket_properties 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-3.1.23/library/systemd/test/data/unknown_socket_properties 2014-03-07 10:34:47.000000000 +0100 @@ -0,0 +1,105 @@ +Id=unknown.socket +Names=unknown.socket +Description=unknown.socket +LoadState=not-found +ActiveState=inactive +SubState=dead +InactiveExitTimestampMonotonic=0 +ActiveEnterTimestampMonotonic=0 +ActiveExitTimestampMonotonic=0 +InactiveEnterTimestampMonotonic=0 +CanStart=yes +CanStop=yes +CanReload=no +CanIsolate=no +StopWhenUnneeded=no +RefuseManualStart=no +RefuseManualStop=no +AllowIsolate=no +DefaultDependencies=yes +OnFailureIsolate=no +IgnoreOnIsolate=no +IgnoreOnSnapshot=no +NeedDaemonReload=no +JobTimeoutUSec=0 +ConditionTimestampMonotonic=0 +ConditionResult=no +LoadError=org.freedesktop.DBus.Error.FileNotFound "No such file or directory" +Transient=no +BindIPv6Only=default +Backlog=128 +TimeoutUSec=1min 30s +ControlPID=0 +DirectoryMode=0755 +SocketMode=0666 +Accept=no +KeepAlive=no +Priority=-1 +ReceiveBuffer=0 +SendBuffer=0 +IPTOS=-1 +IPTTL=-1 +PipeSize=0 +FreeBind=no +Transparent=no +Broadcast=no +PassCredentials=no +PassSecurity=no +Mark=-1 +MaxConnections=64 +NConnections=0 +NAccepted=0 +Result=success +ReusePort=no +UMask=0022 +LimitCPU=18446744073709551615 +LimitFSIZE=18446744073709551615 +LimitDATA=18446744073709551615 +LimitSTACK=18446744073709551615 +LimitCORE=18446744073709551615 +LimitRSS=18446744073709551615 +LimitNOFILE=65536 +LimitAS=18446744073709551615 +LimitNPROC=7770 +LimitMEMLOCK=65536 +LimitLOCKS=18446744073709551615 +LimitSIGPENDING=7770 +LimitMSGQUEUE=819200 +LimitNICE=0 +LimitRTPRIO=0 +LimitRTTIME=18446744073709551615 +OOMScoreAdjust=0 +Nice=0 +IOScheduling=0 +CPUSchedulingPolicy=0 +CPUSchedulingPriority=0 +TimerSlackNSec=50000 +CPUSchedulingResetOnFork=no +NonBlocking=no +StandardInput=null +StandardOutput=journal +StandardError=inherit +TTYReset=no +TTYVHangup=no +TTYVTDisallocate=no +SyslogPriority=30 +SyslogLevelPrefix=yes +SecureBits=0 +CapabilityBoundingSet=18446744073709551615 +MountFlags=0 +PrivateTmp=no +PrivateNetwork=no +SameProcessGroup=no +IgnoreSIGPIPE=yes +NoNewPrivileges=no +KillMode=control-group +KillSignal=15 +SendSIGKILL=yes +SendSIGHUP=no +CPUAccounting=no +CPUShares=1024 +BlockIOAccounting=no +BlockIOWeight=1000 +MemoryAccounting=no +MemoryLimit=18446744073709551615 +DevicePolicy=auto diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.21/library/systemd/test/systemctl_test.rb new/yast2-3.1.23/library/systemd/test/systemctl_test.rb --- old/yast2-3.1.21/library/systemd/test/systemctl_test.rb 2014-03-04 16:41:14.000000000 +0100 +++ new/yast2-3.1.23/library/systemd/test/systemctl_test.rb 2014-03-07 10:34:47.000000000 +0100 @@ -7,11 +7,8 @@ describe Systemctl do include SystemctlStubs - before do - stub_systemctl - end - describe ".socket_units" do + before { stub_systemctl(:socket) } it "returns a list of socket unit ids registered with systemd" do socket_units = Systemctl.socket_units expect(socket_units).to be_a(Array) @@ -19,5 +16,15 @@ socket_units.each {|u| expect(u).to match(/.socket$/) } end end + + describe ".service_units" do + before { stub_systemctl(:service) } + it "returns a list of service units" do + service_units = Systemctl.service_units + expect(service_units).to be_a(Array) + expect(service_units).not_to be_empty + service_units.each {|u| expect(u).to match(/.service$/) } + end + end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.21/library/systemd/test/systemd_service_test.rb new/yast2-3.1.23/library/systemd/test/systemd_service_test.rb --- old/yast2-3.1.21/library/systemd/test/systemd_service_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-3.1.23/library/systemd/test/systemd_service_test.rb 2014-03-07 10:34:47.000000000 +0100 @@ -0,0 +1,71 @@ +#!/usr/bin/env rspec + +require_relative "test_helper" + +module Yast + import 'SystemdService' + + describe SystemdService do + include SystemdServiceStubs + + before do + stub_services + end + + describe ".find" do + it "returns the service unit object specified in parameter" do + ["sshd", "sshd.service"].each do |service_name| + service = SystemdService.find(service_name) + expect(service).to be_a(SystemdUnit) + expect(service.unit_type).to eq("service") + expect(service.unit_name).to eq("sshd") + end + end + + it "returns nil if the service unit does not exist" do + stub_services(:service=>'unknown') + service = SystemdService.find('unknown') + expect(service).to be_nil + end + end + + describe ".find!" do + it "returns the service unit object specified in parameter" do + service = SystemdService.find('sshd') + expect(service).to be_a(SystemdUnit) + expect(service.unit_type).to eq("service") + expect(service.unit_name).to eq("sshd") + end + + it "raises SystemdServiceNotFound error if unit does not exist" do + stub_services(:service=>'unknown') + expect { SystemdService.find!('unknown') }.to raise_error(SystemdServiceNotFound) + end + end + + describe ".all" do + it "returns all supported services found" do + services = SystemdService.all + expect(services).to be_a(Array) + expect(services).not_to be_empty + services.each {|s| expect(s.unit_type).to eq('service')} + end + end + + describe "#running?" do + it "returns true if the service is running" do + service = SystemdService.find "sshd" + expect(service).to respond_to(:running?) + expect(service.running?).to be_true + end + end + + describe "#pid" do + it "returns the pid of the running service" do + service = SystemdService.find("sshd") + expect(service).to respond_to(:pid) + expect(service.pid).not_to be_empty + end + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.21/library/systemd/test/systemd_socket_test.rb new/yast2-3.1.23/library/systemd/test/systemd_socket_test.rb --- old/yast2-3.1.21/library/systemd/test/systemd_socket_test.rb 2014-03-04 16:41:14.000000000 +0100 +++ new/yast2-3.1.23/library/systemd/test/systemd_socket_test.rb 2014-03-07 10:34:47.000000000 +0100 @@ -21,6 +21,20 @@ end end + describe ".find!" do + it "returns the unit object specified in parameter" do + socket = SystemdSocket.find "iscsid" + expect(socket).to be_a(SystemdUnit) + expect(socket.unit_type).to eq("socket") + expect(socket.unit_name).to eq("iscsid") + end + + it "raises SystemdSocketNotFound error if unit does not exist" do + stub_sockets(:socket=>'unknown') + expect { SystemdSocket.find!('unknown') }.to raise_error(SystemdSocketNotFound) + end + end + describe ".all" do it "returns all supported sockets found" do sockets = SystemdSocket.all diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.21/library/systemd/test/systemd_unit_test.rb new/yast2-3.1.23/library/systemd/test/systemd_unit_test.rb --- old/yast2-3.1.21/library/systemd/test/systemd_unit_test.rb 2014-03-04 16:41:14.000000000 +0100 +++ new/yast2-3.1.23/library/systemd/test/systemd_unit_test.rb 2014-03-07 10:34:47.000000000 +0100 @@ -28,7 +28,6 @@ unit = SystemdUnit.new("iscsid.socket") expect(unit.properties[:enabled?]).not_to be_nil expect(unit.properties[:active?]).not_to be_nil - expect(unit.properties[:running?]).not_to be_nil expect(unit.properties[:loaded?]).not_to be_nil expect(unit.properties[:supported?]).not_to be_nil expect(unit.properties[:not_found?]).not_to be_nil @@ -41,7 +40,6 @@ unit = SystemdUnit.new("iscsid.socket") expect(unit).to respond_to(:enabled?) expect(unit).to respond_to(:active?) - expect(unit).to respond_to(:running?) expect(unit).to respond_to(:loaded?) expect(unit).to respond_to(:path) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.21/library/systemd/test/test_helper.rb new/yast2-3.1.23/library/systemd/test/test_helper.rb --- old/yast2-3.1.21/library/systemd/test/test_helper.rb 2014-03-04 16:41:14.000000000 +0100 +++ new/yast2-3.1.23/library/systemd/test/test_helper.rb 2014-03-07 10:34:47.000000000 +0100 @@ -6,9 +6,15 @@ module SystemctlStubs - def stub_systemctl - stub_socket_unit_files - stub_socket_units + def stub_systemctl unit + case unit + when :socket + stub_socket_unit_files + stub_socket_units + when :service + stub_service_unit_files + stub_service_units + end stub_execute end @@ -33,6 +39,30 @@ ) end + def stub_service_unit_files + Yast::Systemctl.stub(:list_unit_files).and_return(<<LIST +single.service masked +smartd.service disabled +smb.service disabled +sshd.service enabled +sssd.service enabled +startpreload.service masked +LIST + ) + end + + def stub_service_units + Yast::Systemctl.stub(:list_units).and_return(<<LIST +rsyslog.service loaded active running System Logging Service +scsidev.service not-found inactive dead scsidev.service +sendmail.service not-found inactive dead sendmail.service +sshd.service loaded active running OpenSSH Daemon +sssd.service loaded active running System Security Services Daemon +SuSEfirewall2.service loaded inactive dead SuSEfirewall2 phase 2 +LIST + ) + end + def stub_socket_units Yast::Systemctl.stub(:list_units).and_return(<<LIST iscsid.socket loaded active listening Open-iSCSI iscsid Socket @@ -66,26 +96,45 @@ include SystemctlStubs include SystemdUnitStubs - def socket_properties - @properties ||= OpenStruct.new( - :stdout => File.read(File.join(__dir__, 'data', 'iscsid_socket_properties')), - :stderr => '', + def load_socket_properties socket_name + OpenStruct.new( + :stdout => File.read(File.join(__dir__, "data", "#{socket_name}_socket_properties")), + :stderr => "", :exit => 0 ) end - def stub_sockets + def stub_sockets socket: 'iscsid' stub_unit_command - stub_systemctl - stub_socket_properties + stub_systemctl(:socket) + properties = load_socket_properties(socket) + Yast::SystemdUnit::Properties + .any_instance + .stub(:load_systemd_properties) + .and_return(properties) end +end + +module SystemdServiceStubs + include SystemctlStubs + include SystemdUnitStubs - def stub_socket_properties + def stub_services service: 'sshd' + stub_unit_command + stub_systemctl(:service) + properties = load_service_properties(service) Yast::SystemdUnit::Properties .any_instance .stub(:load_systemd_properties) - .and_return(socket_properties) + .and_return(properties) end + def load_service_properties service_name + OpenStruct.new( + :stdout => File.read(File.join(__dir__, 'data', "#{service_name}_service_properties")), + :stderr => '', + :exit => 0 + ) + end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.21/package/yast2.changes new/yast2-3.1.23/package/yast2.changes --- old/yast2-3.1.21/package/yast2.changes 2014-03-04 16:41:14.000000000 +0100 +++ new/yast2-3.1.23/package/yast2.changes 2014-03-07 10:34:47.000000000 +0100 @@ -1,4 +1,17 @@ ------------------------------------------------------------------- +Thu Mar 6 15:21:44 UTC 2014 - vmoravec@suse.com + +- Allow raising exceptions for not found systemd units; + updates the expectations for bnc#853300 +- 3.1.23 + +------------------------------------------------------------------- +Thu Mar 6 07:48:29 UTC 2014 - vmoravec@suse.com + +- Add systemd service support; needed by fate#314946 +- 3.1.22 + +------------------------------------------------------------------- Tue Mar 4 12:20:41 UTC 2014 - vmoravec@suse.com - Allow the Service module to configure services witout diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.1.21/package/yast2.spec new/yast2-3.1.23/package/yast2.spec --- old/yast2-3.1.21/package/yast2.spec 2014-03-04 16:41:14.000000000 +0100 +++ new/yast2-3.1.23/package/yast2.spec 2014-03-07 10:34:47.000000000 +0100 @@ -17,7 +17,7 @@ Name: yast2 -Version: 3.1.21 +Version: 3.1.23 Release: 0 URL: https://github.com/yast/yast-yast2 continue with "q"... Checked in at Fri Mar 7 17:10:53 CET 2014 by ro Remember to have fun... -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
ro