Hello community, here is the log from the commit of package webyast-services-ws for openSUSE:Factory checked in at Fri Jan 14 11:12:20 CET 2011. -------- New Changes file: --- /dev/null 2010-08-26 16:28:41.000000000 +0200 +++ /mounts/work_src_done/STABLE/webyast-services-ws/webyast-services-ws.changes 2010-08-23 15:57:40.000000000 +0200 @@ -0,0 +1,249 @@ +------------------------------------------------------------------- +Mon Aug 23 13:48:40 UTC 2010 - jreidinger@novell.com + +- add url to spec file (bnc#625537) +- move tasks to lib directory (bnc#622957) +- 0.2.6 + +------------------------------------------------------------------- +Thu Aug 12 11:23:11 CEST 2010 - jsuchome@suse.cz + +- updated documentation of config files +- 0.2.5 + +------------------------------------------------------------------- +Fri Aug 6 09:23:45 CEST 2010 - jsuchome@suse.cz + +- check vendor subdirectory for config files (bnc#628654) +- 0.2.4 + +------------------------------------------------------------------- +Tue Jul 27 12:26:30 CEST 2010 - jsuchome@suse.cz + +- raise ServiceError on errors (bnc#625831) +- 0.2.3 + +------------------------------------------------------------------- +Tue Jul 13 10:26:53 CEST 2010 - jsuchome@suse.cz + +- specify type of integer and boolean in xml (bnc#621822) +- 0.2.2 + +------------------------------------------------------------------- +Thu Jul 8 11:04:14 UTC 2010 - jreidinger@novell.com + +- fix json serialization +- fix tests +- 0.2.1 + +------------------------------------------------------------------- +Thu May 20 14:35:22 CEST 2010 - jsuchome@suse.cz + +- backup to default runlevel when current is not known (bnc#607098) +- 0.2.0 + +------------------------------------------------------------------- +Wed May 5 10:22:59 CEST 2010 - jsuchome@suse.cz + +- update rest service documentation +- 0.1.15 + +------------------------------------------------------------------- +Fri Apr 30 14:33:25 UTC 2010 - jreidinger@novell.com + +- fix spec file consistency (bnc#560061) +- 0.1.14 + +------------------------------------------------------------------- +Fri Apr 30 09:04:34 CEST 2010 - jsuchome@suse.cz + +- start required services on selected service restart (bnc#600489) +- 0.1.13 + +------------------------------------------------------------------- +Wed Apr 28 13:36:56 CEST 2010 - jsuchome@suse.cz + +- do not change on-boot status with restart action (bnc#600373) +- 0.1.12 + +------------------------------------------------------------------- +Fri Apr 23 12:16:12 UTC 2010 - jreidinger@novell.com + +- add license headers (bnc#586620) +- 0.1.11 + +------------------------------------------------------------------- +Mon Apr 12 10:16:54 CEST 2010 - jsuchome@suse.cz + +- update summary and description of packages (bnc#588355) +- 0.1.10 + +------------------------------------------------------------------- +Tue Mar 30 11:18:10 CEST 2010 - jsuchome@suse.cz + +- ignore DBUS timeout exception when handling ntp (bnc#582810) +- 0.1.9 + +------------------------------------------------------------------- +Mon Mar 29 13:42:15 CEST 2010 - mvidner@suse.cz + +- RPM-Provide WebYaST(org.opensuse.yast.modules.FOO) (bnc#583561) +- 0.1.8 + +------------------------------------------------------------------- +Thu Mar 25 13:46:12 CET 2010 - jsuchome@suse.cz + +- filter out dependencies not usable in UI + +------------------------------------------------------------------- +Wed Mar 24 16:34:17 CET 2010 - jsuchome@suse.cz + +- SERVICES.pm: do Execute and Enable actions for required services + as well (bnc#587876c13) +- return the service dependencies in the data model +- 0.1.7 + +------------------------------------------------------------------- +Thu Mar 18 07:54:13 CET 2010 - jsuchome@suse.cz + +- SERVICES.pm: do not check on-boot status of custom service + +------------------------------------------------------------------- +Wed Mar 17 14:22:40 CET 2010 - jsuchome@suse.cz + +- SERVICES.pm: fixed self->Enable call +- return also "enabled" when asked for service status +- 0.1.6 + +------------------------------------------------------------------- +Tue Mar 16 15:09:59 CET 2010 - jsuchome@suse.cz + +- SERVICES.pm now resides here, not in yast2 (bnc#587876) +- remember 'enabled' status of each service (bmc#587879) +- 0.1.5 + +------------------------------------------------------------------- +Thu Mar 11 16:29:59 CET 2010 - jsuchome@suse.cz + +- updated documentation + +------------------------------------------------------------------- +Wed Mar 3 20:32:33 CET 2010 - jsuchome@suse.cz + +- added support for only showing specified services, using + filter_services.yml config file (fate#308409) +- save information if service is 'custom', it has different + handling in YaPI +- 0.1.4 + +------------------------------------------------------------------- +Tue Feb 23 08:54:01 CET 2010 - jsuchome@suse.cz + +- require correct versions of yast2 package, no need to check for + SLE11GA (bnc#556112) +- 0.1.3 + +------------------------------------------------------------------- +Thu Feb 11 12:01:16 CET 2010 - jsuchome@suse.cz + +- read both short and full description (bnc#579036) +- 0.1.2 + +------------------------------------------------------------------- +Wed Jan 27 15:58:12 CET 2010 - jsuchome@suse.cz + +- 0.1.1 + +------------------------------------------------------------------- +Mon Jan 25 17:24:26 CET 2010 - mvidner@suse.cz + +- renamed yast2-webservice-services to webyast-services-ws + +------------------------------------------------------------------- +Mon Jan 18 14:27:39 CET 2010 - jsuchome@suse.cz + +- require also correct 11.2 version of yast2 package +- read service descriptions (bnc#570298) +- get service status using the read call (bnc#570968) +- 0.0.14 + +------------------------------------------------------------------- +Tue Nov 10 14:04:58 CET 2009 - jsuchome@suse.cz + +- require SLE11 version of yast2 package +- 0.0.13 + +------------------------------------------------------------------- +Thu Nov 5 17:25:23 CET 2009 - jsuchome@suse.cz + +- require correct version of ruby-bindings +- 0.0.12 + +------------------------------------------------------------------- +Wed Nov 4 14:03:24 CET 2009 - jsuchome@suse.cz + +- adapted to changes in SERVICES.pm: new API for Execute, + use YaPI for all services (bnc#551276) +- include YML.rb for parsing yml files from YaST +- 0.0.11 + +------------------------------------------------------------------- +Fri Oct 30 08:04:50 CET 2009 - lslezak@suse.cz + +- fixed restdoc packaging +- 0.0.10 + +------------------------------------------------------------------- +Thu Oct 29 14:48:07 CET 2009 - jsuchome@suse.cz ++++ 52 more lines (skipped) ++++ between /dev/null ++++ and /mounts/work_src_done/STABLE/webyast-services-ws/webyast-services-ws.changes calling whatdependson for head-i586 New: ---- filter_services.yml org.opensuse.yast.modules.yapi.services.policy SERVICES.pm webyast-services-ws.changes webyast-services-ws-rpmlintrc webyast-services-ws.spec www.tar.bz2 YML.rb ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ webyast-services-ws.spec ++++++ # # spec file for package webyast-services-ws # # Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via http://bugs.opensuse.org/ # Name: webyast-services-ws Provides: WebYaST(org.opensuse.yast.modules.yapi.services) Provides: yast2-webservice-services = %{version} Obsoletes: yast2-webservice-services < %{version} PreReq: yast2-webservice License: GPLv2 Group: Productivity/Networking/Web/Utilities Url: http://en.opensuse.org/Portal:WebYaST AutoReqProv: on Version: 0.2.6 Release: 1 Summary: WebYaST - system services management service Source: www.tar.bz2 Source1: org.opensuse.yast.modules.yapi.services.policy Source2: YML.rb Source3: filter_services.yml Source4: SERVICES.pm BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildArch: noarch BuildRequires: rubygem-restility rubygem-yast2-webservice-tasks BuildRequires: webyast-base-ws-testsuite BuildRequires: rubygem-mocha rubygem-test-unit # so SERVICES.pm is able to call YML.rb Requires: yast2-ruby-bindings >= 0.3.2.1 # for SERVICES.pm Requires: yast2-runlevel # %define plugin_name services %define plugin_dir %{webyast_ws_dir}/vendor/plugins/%{plugin_name} # %package testsuite License: GPLv2 Group: Productivity/Networking/Web/Utilities Requires: %{name} = %{version} Requires: webyast-base-ws-testsuite Summary: Testsuite for webyast-services-ws package %description WebYaST - Plugin providing REST based interface to handle system services. Authors: -------- Stefan Schubert <schubi@opensuse.org> Jiri Suchomel <jsuchome@suse.cz> Ladislav Slezak <lslezak@suse.cz> %description testsuite This package contains complete testsuite for webyast-services-ws webservice package. It's only needed for verifying the functionality of the module and it's not needed at runtime. %prep %setup -q -n www %build # build restdoc documentation mkdir -p public/services/restdoc %webyast_ws_restdoc # do not package restdoc sources rm -rf restdoc %check # run the testsuite %webyast_ws_check %install # # Install all web and frontend parts. # mkdir -p $RPM_BUILD_ROOT%{plugin_dir} cp -a * $RPM_BUILD_ROOT%{plugin_dir}/ rm -f $RPM_BUILD_ROOT%{plugin_dir}/COPYING # Policies mkdir -p $RPM_BUILD_ROOT/usr/share/PolicyKit/policy install -m 0644 %SOURCE1 $RPM_BUILD_ROOT/usr/share/PolicyKit/policy/ # YML.rb mkdir -p $RPM_BUILD_ROOT/usr/share/YaST2/modules/ cp %{SOURCE2} $RPM_BUILD_ROOT/usr/share/YaST2/modules/ # SERVICES.pm mkdir -p $RPM_BUILD_ROOT/usr/share/YaST2/modules/YaPI/ cp %{SOURCE4} $RPM_BUILD_ROOT/usr/share/YaST2/modules/YaPI/ # copy example filter_services.yml mkdir -p $RPM_BUILD_ROOT/etc/webyast/ cp %SOURCE3 $RPM_BUILD_ROOT/etc/webyast/ %clean rm -rf $RPM_BUILD_ROOT %post # # granting all permissions for root # /usr/sbin/grantwebyastrights --user root --action grant > /dev/null ||: /usr/sbin/grantwebyastrights --user %{webyast_ws_user} --action grant > /dev/null ||: %files %defattr(-,root,root) %dir %{webyast_ws_dir} %dir %{webyast_ws_dir}/vendor %dir %{webyast_ws_dir}/vendor/plugins %dir %{plugin_dir} %dir %{plugin_dir}/doc %dir /usr/share/YaST2/ %dir /usr/share/YaST2/modules/ %dir /usr/share/YaST2/modules/YaPI/ %dir /usr/share/PolicyKit %dir /usr/share/PolicyKit/policy %dir /etc/webyast/ %config /etc/webyast/filter_services.yml %{plugin_dir}/README %{plugin_dir}/Rakefile %{plugin_dir}/init.rb %{plugin_dir}/install.rb %{plugin_dir}/uninstall.rb %{plugin_dir}/app %{plugin_dir}/config %{plugin_dir}/public %{plugin_dir}/doc %{plugin_dir}/lib /usr/share/YaST2/modules/YML.rb /usr/share/YaST2/modules/YaPI/SERVICES.pm %attr(644,root,root) %config /usr/share/PolicyKit/policy/org.opensuse.yast.modules.yapi.services.policy %doc COPYING %files testsuite %defattr(-,root,root) %{plugin_dir}/test %changelog ++++++ filter_services.yml ++++++ # Under 'services' write a list of services that should be shown in UI # (in this order). # # As service names, use both standard services defined in /etc/init.d and # the custom ones defined in /etc/webyast/custom_services.yml # # If the list is empty, all services will be shown. # # This file is installed as /etc/webyast/filter_services.yml, # but higher priority has a file /etc/webyast/vendor/filter_services.yml. # So to package vendor specific configuration, use /etc/webyast/vendor/ # subdirectory to avoid file conflicts. services: # - cron # - my_own_service # - nfs # - cups ++++++ SERVICES.pm ++++++ #-- # Copyright (c) 2009-2010 Novell, Inc. # # All Rights Reserved. # # This program is free software; you can redistribute it and/or modify it # under the terms of version 2 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 Novell, Inc. # # To contact Novell about this file by physical or electronic mail, # you may find current contact information at www.novell.com #++ package YaPI::SERVICES; use strict; use YaST::YCP qw(:LOGGING); use YaPI; use Data::Dumper; # ------------------- imported modules YaST::YCP::Import ("Directory"); YaST::YCP::Import ("FileUtils"); YaST::YCP::Import ("Package"); YaST::YCP::Import ("Progress"); YaST::YCP::Import ("Service"); YaST::YCP::Import ("SCR"); YaST::YCP::Import ("Report"); YaST::YCP::Import ("RunlevelEd"); # ------------------------------------- our $VERSION = '1.0.0'; our @CAPABILITIES = ('SLES11'); our %TYPEINFO; my $custom_services_dir = "/etc/webyast"; my $custom_services_file = "custom_services.yml"; my $error_message = ""; # check for key presence in given list sub contains { my ( $list, $key, $ignorecase ) = @_; if ( $ignorecase ) { if ( grep /^$key$/i, @{$list} ) { return 1; } } else { if ( grep /^$key$/, @{$list} ) { return 1; } } return 0; } # log error message and fill it into $error_message variable sub report_error { $error_message = shift; y2error ($error_message); } # parse the file with custom services and return the hash describing the file sub parse_custom_services { my $custom_services_path = "$custom_services_dir/vendor/$custom_services_file"; unless (FileUtils->Exists ($custom_services_path)) { y2milestone ("$custom_services_path not available, using default"); $custom_services_path = "$custom_services_dir/$custom_services_file" } if (!FileUtils->Exists ($custom_services_path)) { report_error ("$custom_services_path file not present"); return {}; } if (!Package->Installed ("yast2-ruby-bindings")) { report_error ("yast2-ruby-bindings not installed, cannot read custom services"); return {}; } if (!FileUtils->Exists (Directory->moduledir()."/YML.rb")) { report_error ("YML.rb not present, cannot parse config file"); return {}; } YaST::YCP::Import ("YML"); my $parsed = YML->parse ($custom_services_path); if (!defined $parsed || ref ($parsed) ne "HASH") { report_error ("custom services file could not be read"); return {}; } return $parsed; } # read the list of custom services and return the information about them # if requested, read the status of services sub read_custom_services { my $args = shift; my @ret = (); my $services = parse_custom_services (); foreach my $name (keys %$services) { my $s = { "name" => $name }; $s->{"description"} = ($services->{$name}{"description"} || "") if $args->{"description"} || 0; $s->{"shortdescription"}= ($services->{$name}{"shortdescription"} || "") if $args->{"shortdescription"} || 0; # read list of available commands, it may be limited for 'custom service' my @commands = (); foreach my $key (keys %{$services->{$name}}) { if (contains (["start","stop","restart","reload","try-restart"], $key, 1)) { push @commands, $key; } } $s->{"commands"} = @commands; if ($args->{"read_status"} || 0) { my $cmd = $services->{$name}{"status"}; if (!$cmd) { report_error ("status script for $name not defined or empty"); next; } my $out = SCR->Execute (".target.bash_output", $cmd); $s->{"status"} = $out->{"exit"}; } push @ret, $s; } return @ret; } # read infomation about custom service and execute given command with it sub execute_custom_script { my $name = shift; my $action = shift; my $services = parse_custom_services (); my $ret = { "stdout" => "", "stderr" => "failure", "exit" => 255 }; if (%$services) { my $service = $services->{$name}; if (!defined $service || ref ($service) ne "HASH" || ! %$service) { report_error ("service $name not defined or empty in config file"); $ret->{"stderr"} = $error_message; return $ret; } my $cmd = $services->{$name}{$action}; if (!$cmd) { report_error ("'$action' script for $name not defined or empty"); $ret->{"stderr"} = $error_message; return $ret; } $ret = SCR->Execute (".target.bash_output", $cmd); } return $ret; } # Return the list of services enabled in given runlevel, or even all available. # # Parameter is an argument map with possible keys: # "service" : if defined, only the status of _this given service_ will be returned (= list with one item) # "runlevel" : integer; if not defined, current runlevel will be used # "read_status" : if true, service status will be queried and returned for each service # "custom" : if true, custom services (defined in config file) will be read (otherwise list of init.d services) # "description" : if true, read the description of each service # "only_enabled" : if true, return only list of services enabled in given runlevel # - neither "start_runlevels", nor "enabled" key will be part of resulting maps # "start_runlevels" if true, each service's result map will contain list of runlevels where it is started # - if not present (or false), "enabled" key with boolean value will be returned instead # "filter" : list of strings; defines filtered list of services that should be returned # @returns array of hashes BEGIN{$TYPEINFO{Read} = ["function", ["list", [ "map", "string", "any"]], ["map", "string", "any"]]; } sub Read { my $self = shift; my $args = shift; my @ret = (); my $runlevel = $args->{"runlevel"} || ""; $runlevel = SCR->Read (".init.scripts.current_runlevel") unless ($runlevel); unless ($runlevel) { $runlevel = SCR->Read (".init.scripts.default_runlevel"); y2warning ("current runlevel not available, using default ('$runlevel')"); } my @filter = (); @filter = @{$args->{"filter"}} if defined $args->{"filter"}; my $filter_map= {}; foreach my $s (@filter) { $filter_map->{$s} = 1; } # only read status of one service if the name was given if ($args->{"service"} || "") { my $name = $args->{"service"} || ""; my $exec = $self->Execute ({ "name" => $name, "action" => "status", "only_execute" => 1, "only_this" => 1, "custom" => $args->{"custom"} || 0 }); my $s = { "name" => $name, "status" => $exec->{"exit"} || 0, # custom service is always 'enabled' (in fact, we can't check) "enabled" => ($args->{"custom"} || 0) || YaST::YCP::Boolean (Service->Enabled ($name)) }; push @ret, $s; return @ret; } # read only custom services if ($args->{"custom"} || 0) { return read_custom_services ($args); } if ($args->{"only_enabled"}) { # generate the output list foreach my $name (@{Service->EnabledServices ($runlevel)}) { next if (@filter && !defined $filter_map->{$name}); # should not be returned my $s = { "name" => $name, }; $s->{"status"} = Service->Status ($name) if ($args->{"read_status"} || 0); if (($args->{"description"} || 0) || ($args->{"shortdescription"} || 0)) { my $info = Service->Info ($name); $s->{"description"} = ($info->{"description"} || "") if $args->{"description"} || 0; $s->{"shortdescription"}= ($info->{"shortdescription"} || "") if $args->{"shortdescription"} || 0; } push @ret, $s; } } else { my $progress_orig = Progress->set (0); Report->DisplayErrors (0, 0); RunlevelEd->Read (); my $full_services = RunlevelEd->services (); while (my ($name, $info) = each %$full_services) { next if (@filter && !defined $filter_map->{$name}); # should not be returned next if (contains ($info->{"defstart"} || [], "B", 1)); my $s = { "name" => $name }; if ($args->{"start_runlevels"} || 0) { $s->{"start_runlevels"} = $info->{"start"} || []; } else { my $start = $info->{"start"} || []; # for "B" check, see RunlevelEd::StartContainsImplicitly $s->{"enabled"} = YaST::YCP::Boolean (contains ($start, $runlevel, 1) || contains ($start, "B", 1)); } # return start and stop dependencies for each service if ($args->{"dependencies"} || 0) { my @required_for_start = (); # filter out services started on boot by default: foreach my $rq (@{RunlevelEd->ServiceDependencies ($name, 1)}) { my $start = $full_services->{$rq}{"start"} || []; push @required_for_start, $rq unless contains ($start, "B", 1); } $s->{"required_for_start"} = @required_for_start; $s->{"required_for_stop"} = RunlevelEd->ServiceDependencies ($name, 0); } $s->{"status"} = Service->Status ($name) if ($args->{"read_status"} || 0); $s->{"description"} = ($info->{"description"} || "") if $args->{"description"} || 0; $s->{"shortdescription"}= ($info->{"shortdescription"} || "") if $args->{"shortdescription"} || 0; push @ret, $s; } Progress->set ($progress_orig); } return @ret; } # Return the status of given service # return value is the exit code of status function BEGIN{$TYPEINFO{Get} = ["function", "integer", "string" ]; } sub Get { my $self = shift; my $name = shift; return Service->Status ($name); } # Executes an action (e.g. "restart") with given service # If the action is start or stop, it will also enable (resp. disable) # the service for current runlevel. # # parameter is a map where "name" is service name, "action" means what to do # - if "only_execute" key is present, do not continue with enabling/disabling # - if action is "enable" or "disable", only enables/disables service # - if "custom" key is present (with true value), indicates custom service, which # has special handling. Also, custom service will not be enabled/disabled. # # return value is map with "exit", "stdout" and "stderr" keys BEGIN{$TYPEINFO{Execute} = ["function", [ "map", "string", "any"], [ "map", "string", "any"]]; } sub Execute { my $self = shift; my $args = shift; my $name = $args->{"name"} || ""; my $action = $args->{"action"} || ""; my $ret = {}; y2debug ("Execute args: ", Dumper ($args)); # no enable/disable my $only_execute = $args->{"only_execute"} || 0; # do not solve dependencies my $only_this = $args->{"only_this"} || 0; # just a shurtcut, so Execute function can be used for Enable only return $self->Enable ($args) if ($action eq "enable" || $action eq "disable"); # custom service has special handling if ($args->{"custom"} || 0) { return execute_custom_script ($name, $action); } # only handle given service, not dependencies elsif ($only_this) { $ret = Service->RunInitScriptOutput ($name, $action); unless ($only_execute) { if (($ret->{"exit"} || 0) ne 0) { y2error ("action '$action' failed"); return $ret; } if ($action eq "start") { $args->{"action"} = "enable"; } else { $args->{"action"} = "disable"; } return $self->Enable ($args); } } # full action: start/stop and enable/disable required service else { my $progress_orig = Progress->set (0); RunlevelEd->Read (); Progress->set ($progress_orig); my $full_services = RunlevelEd->services (); my $runlevel = RunlevelEd->GetCurrentRunlevel (); if ($runlevel eq "unknown") { $runlevel = RunlevelEd->GetDefaultRunlevel (); y2warning ("current runlevel not available, using default ('$runlevel')"); } # in fact, this may mean "start & enable" (depends on $only_execute) my $start = ($action eq "start") || ($action eq "restart"); # list of runlevels where the service should be enabled my $rls = $start? ($full_services->{$name}{"defstart"} || []) : undef; # list of dependencies my $dep_s = RunlevelEd->ServiceDependencies ($name, $start); # filtered list; unfortunatelly it does not really check for current status $dep_s = RunlevelEd->FilterAlreadyDoneServices ($dep_s, $rls, $start, 1, 1); my $enable_args = { "action" => ($action eq "start") ? "enable" : "disable", # we're solving dependencies here, so no need to do it in Enable call again "only_this" => 1 }; foreach my $s (@$dep_s) { # check if service is not already running my $status = Service->Status ($s); # action for required service: when restarting selected, only start required ones my $req_action = ($action eq "restart") ? "start" : $action; if (($start && $status != 0) || ($status == 0 && !$start)) { # RunInitScriptWithTimeOut would be better, but does not return stderr $ret = Service->RunInitScriptOutput ($s, $req_action); } if (($ret->{"exit"} || 0) ne 0) { y2error ("action '$req_action' for service '$s' failed"); return $ret; } next if $only_execute; my $startlist = $full_services->{$s}{"start"} || []; my $service_enabled = contains ($startlist, $runlevel, 1) || contains ($startlist, "B", 1); if (($start && !$service_enabled) || (!$start && $service_enabled)) { $enable_args->{"name"} = $s; $ret = $self->Enable ($enable_args); } if (($ret->{"exit"} || 0) ne 0) { y2error ("insserv call for service '$s' failed"); return $ret; } } # now, finally start/stop our service... $ret = Service->RunInitScriptOutput ($name, $action); if (($ret->{"exit"} || 0) ne 0) { y2error ("action '$action' for service '$name' failed"); return $ret; } return $ret if $only_execute; # ... and enable/disable it $enable_args->{"name"} = $name; $ret = $self->Enable ($enable_args); } return $ret; } # Enable/Disable given service in current runlevel # parameter is a map where "name" is service name, "action" means what to do # return value is map with "exit", "stdout" and "stderr" keys BEGIN{$TYPEINFO{Enable} = ["function", [ "map", "string", "any"], [ "map", "string", "any"]]; } sub Enable { my $self = shift; my $args = shift; my $name = $args->{"name"} || ""; my $action = $args->{"action"} || ""; my $ret = { "stdout" => "", "stderr" => "", "exit" => 0 }; # do not solve dependencies my $only_this = $args->{"only_this"} || 0; y2debug ("Enable args: ", Dumper ($args)); # enable/disable with dependencies unless ($only_this) { my $progress_orig = Progress->set (0); Report->DisplayErrors (0, 0); RunlevelEd->Read (); my $exit = 0; if ($action eq "enable") { $exit = RunlevelEd->ServiceInstall ($name, undef); if ($exit == 1) { $ret->{"stderr"} = "Failed to enable service $name."; $ret->{"stdout"} = $name; $ret->{"exit"} = 1000; } } elsif ($action eq "disable") { $exit = RunlevelEd->ServiceRemove ($name, undef); if ($exit == 1) { $ret->{"stderr"} = "Failed to disable service $name."; $ret->{"stdout"} = $name; $ret->{"exit"} = 2000; } } unless (RunlevelEd->Write ()) { $ret->{"stderr"} = "Failed during writing runlevel settings."; $ret->{"exit"} = 3000; } Progress->set ($progress_orig); return $ret; } if ($action eq "enable") { unless (Service->Enable ($name)) { $ret->{"stderr"} = "Failed to enable service $name."; $ret->{"stdout"} = $name; $ret->{"exit"} = 1000; } } elsif ($action eq "disable") { unless (Service->Disable ($name)) { $ret->{"stderr"} = "Failed to disable service $name."; $ret->{"stdout"} = $name; $ret->{"exit"} = 2000; } } else { $ret->{"stderr"} = "Unknown action '$action'"; $ret->{"exit"} = 3; } return $ret; } 1; ++++++ webyast-services-ws-rpmlintrc ++++++ # ignore security warnings (unauthorized PolicyKit permissions) for now addFilter("I: polkit-unauthorized-privilege") ++++++ YML.rb ++++++ #-- # Copyright (c) 2009-2010 Novell, Inc. # # All Rights Reserved. # # This program is free software; you can redistribute it and/or modify it # under the terms of version 2 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 Novell, Inc. # # To contact Novell about this file by physical or electronic mail, # you may find current contact information at www.novell.com #++ require 'yaml' # simple module for parsimg yaml files module YML def self.parse(file_name) ret = {} if File.exists?(file_name) ret = YAML::load(File.open(file_name)); ret = {} unless ret.is_a? Hash end return ret end end ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org