Author: lslezak Date: Fri Oct 17 12:08:30 2008 New Revision: 52325 URL: http://svn.opensuse.org/viewcvs/yast?rev=52325&view=rev Log: - fixed ServiceDelete() - delete also the repositories belonging to the deleted service, similar fix in enabling/disabling a service via ServiceSet() (bnc#435711) Modified: trunk/pkg-bindings/package/yast2-pkg-bindings.changes trunk/pkg-bindings/src/Service.cc Modified: trunk/pkg-bindings/package/yast2-pkg-bindings.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/package/yast2-pkg-bindings.changes?rev=52325&r1=52324&r2=52325&view=diff ============================================================================== --- trunk/pkg-bindings/package/yast2-pkg-bindings.changes (original) +++ trunk/pkg-bindings/package/yast2-pkg-bindings.changes Fri Oct 17 12:08:30 2008 @@ -1,6 +1,9 @@ ------------------------------------------------------------------- -Fri Oct 17 10:58:43 CEST 2008 - lslezak@suse.cz +Fri Oct 17 12:06:44 CEST 2008 - lslezak@suse.cz +- fixed ServiceDelete() - delete also the repositories belonging + to the deleted service, similar fix in enabling/disabling + a service via ServiceSet() (bnc#435711) - fixed network detection command (bnc#435970) ------------------------------------------------------------------- Modified: trunk/pkg-bindings/src/Service.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/src/Service.cc?rev=52325&r1=52324&r2=52325&view=diff ============================================================================== --- trunk/pkg-bindings/src/Service.cc (original) +++ trunk/pkg-bindings/src/Service.cc Fri Oct 17 12:08:30 2008 @@ -98,7 +98,27 @@ return YCPBoolean(false); } - return YCPBoolean(service_manager.RemoveService(alias->value())); + std::string service_alias = alias->value(); + bool ret = service_manager.RemoveService(service_alias); + + if (ret) + { + RepoId index = 0; + // delete the repositories that belong to the service + for( RepoCont::const_iterator it = repos.begin(); it != repos.end() ; ++it, ++index ) + { + YRepo_Ptr repo = *it; + if (repo->repoInfo().service() == service_alias) + { + std::string repo_alias = repo->repoInfo().alias(); + y2milestone("Removing repository %zd (%s) belonging to service %s", + index, repo_alias.c_str(), service_alias.c_str()); + repo->setDeleted(); + } + } + } + + return YCPBoolean(ret); } catch (const zypp::Exception& excpt) { @@ -174,6 +194,7 @@ try { + std::string old_alias_str(old_alias->value()); zypp::ServiceInfo s(service_manager.GetService(old_alias->value())); YCPValue v; @@ -204,7 +225,25 @@ v = service->value(YCPString("enabled")); if(!v.isNull() && v->isBoolean()) { - s.setEnabled(v->asBoolean()->value()); + bool enabled = v->asBoolean()->value(); + s.setEnabled(enabled); + + // enable/disable the repositories belonging to the service + RepoId index = 0; + for( RepoCont::const_iterator it = repos.begin(); it != repos.end() ; ++it, ++index ) + { + YRepo_Ptr repo = *it; + if (repo->repoInfo().enabled() != enabled && repo->repoInfo().service() == old_alias_str + && !repo->isDeleted()) + { + std::string repo_alias = repo->repoInfo().alias(); + + y2milestone("%s repository %zd (%s) belonging to service %s", + enabled ? "Enabling" : "Disabling", index, repo_alias.c_str(), old_alias_str.c_str()); + + repo->repoInfo().setEnabled(enabled); + } + } } // note: do not allow to change the file name? -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org