Re: [Spacewalk-devel] [PATCH] Filters on reposync

2011-10-18 Thread Michael Mraka
Baptiste AGASSE wrote:
% Hi,
% 
% I've just looked at reposync.py code a I don't see any part related to
% getting include/exclude filters from database as properties of
% repositories that Jan asked me when i've submited  some code for
% filters (he said that he didn't like that filters are specified at
% runtime).
% 
% Any news on it ?  If, you decide to store filters in database, these
% will be accessible through repositories webui ?

Hi Baptiste,

yesterday and today I finally saved some time to look into it again.  I
added a database table to hold include/exclude filters and
spacewalk-repo-sync code which is able to use it. Unfortunately there's
not webUI part yet so if you want to check it you have to insert filter
data directy into database.  E.g.

  insert into rhncontentsourcefilter (id, source_id, sort_order, flag, filter)
values (sequence_nextval('rhn_csf_id_seq') , 536, 1, '+', 'samba-client');

where source_id is repository id (that's the end part as in
https://spacewalk/rhn/channels/manage/repos/RepoEdit.do?id=536 url),
sort_order specifies the order of filters which belong to the same repo,
flag is either '+' or '-' (include / exclude) and filter is the list of
packages to be filtered.


Regards.


--
Michael Mráka
Satellite Engineering, Red Hat

___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Re: [Spacewalk-devel] erratas and the client plugin package action

2011-10-18 Thread Ionuț Arțăriși

On 05/13/2011 02:27 PM, Miroslav Suchý wrote:

On 05/13/2011 02:22 PM, Duncan Mac-Vicar P. wrote:

Would it make more sense for errata.py to be in the yum-rhn-plugin?

It fine with me. yum-rhn-plugin and rhn-client-tools require each other
(on rhel/fedora) anyway. So yes, it can be moved to yum-rhn-plugin.


For *SUSE I think we will have to override errata.py as zypper should
install the patch directly and not let the plugin resolve the package list.

Would it be acceptable upstream that we don't install errata.py from the
.spec file %if 0%{?suse_version} and supply it with
zypp-plugin-spacewalk (which contains package.py)?

That possible as well.

I slightly prefer the first option (move it to yum-rhn-plugin). But
choose yourself.

Can we still move errata.py to yum-rhn-plugin? We've gone with the 
second option until now, but this would make packaging cleaner.


-Ionuț
From 8bfecb11e2f14b1f922bb2986693840e8dc77107 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ionu=C8=9B=20Ar=C8=9B=C4=83ri=C8=99i?= iartar...@suse.cz
Date: Tue, 18 Oct 2011 16:49:24 +0200
Subject: [PATCH] move errata.py action to the yum-rhn-plugin package

---
 client/rhel/rhn-client-tools/rhn-client-tools.spec |1 -
 client/rhel/rhn-client-tools/src/actions/Makefile  |2 +-
 client/rhel/rhn-client-tools/src/actions/errata.py |   87 
 client/rhel/yum-rhn-plugin/actions/errata.py   |   87 
 4 files changed, 88 insertions(+), 89 deletions(-)
 delete mode 100644 client/rhel/rhn-client-tools/src/actions/errata.py
 create mode 100644 client/rhel/yum-rhn-plugin/actions/errata.py

diff --git a/client/rhel/rhn-client-tools/rhn-client-tools.spec b/client/rhel/rhn-client-tools/rhn-client-tools.spec
index 8d9f58b..51292fb 100644
--- a/client/rhel/rhn-client-tools/rhn-client-tools.spec
+++ b/client/rhel/rhn-client-tools/rhn-client-tools.spec
@@ -249,7 +249,6 @@ make -f Makefile.rhn-client-tools test
 # actions for rhn_check to run
 %{_datadir}/rhn/actions/__init__.*
 %{_datadir}/rhn/actions/hardware.*
-%{_datadir}/rhn/actions/errata.*
 %{_datadir}/rhn/actions/systemid.*
 %{_datadir}/rhn/actions/reboot.*
 %{_datadir}/rhn/actions/rhnsd.*
diff --git a/client/rhel/rhn-client-tools/src/actions/Makefile b/client/rhel/rhn-client-tools/src/actions/Makefile
index 2d72848..fec4eff 100644
--- a/client/rhel/rhn-client-tools/src/actions/Makefile
+++ b/client/rhel/rhn-client-tools/src/actions/Makefile
@@ -3,7 +3,7 @@
 # $Id$
 
 ACTIONS		= up2date_config hardware reboot \
-		  rhnsd systemid errata __init__
+		  rhnsd systemid __init__
 PYFILES		= $(addsuffix .py, $(ACTIONS))
 OBJECTS		= $(PYFILES) $(addsuffix .pyc, $(ACTIONS))
 
diff --git a/client/rhel/rhn-client-tools/src/actions/errata.py b/client/rhel/rhn-client-tools/src/actions/errata.py
deleted file mode 100644
index 49f1c65..000
--- a/client/rhel/rhn-client-tools/src/actions/errata.py
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/usr/bin/python
-
-# Client code for Update Agent
-# Copyright (c) 1999-2002 Red Hat, Inc.  Distributed under GPL.
-#
-# Author: Adrian Likins alik...@redhat.com
-#
-
-import sys
-sys.path.append(/usr/share/rhn/)
-from up2date_client import rhnserver
-from up2date_client import up2dateAuth
-from up2date_client import pkgUtils
-from actions import packages
-
-__rhnexport__ = [
-'update']
-
-# action version we understand
-ACTION_VERSION = 2 
-
-def __getErrataInfo(errata_id):
-s = rhnserver.RhnServer()
-return s.errata.getErrataInfo(up2dateAuth.getSystemId(), errata_id)
-
-def update(errataidlist, cache_only=None):
-packagelist = []
-
-if type(errataidlist) not in [type([]), type(())]:
-errataidlist = [ errataidlist ]
-
-for errataid in errataidlist:
-tmpList = __getErrataInfo(errataid)
-packagelist = packagelist + tmpList
-
-current_packages_with_arch = {}
-current_packages ={}
-for p in pkgUtils.getInstalledPackageList(getArch=1):
-current_packages_with_arch[p['name']+p['arch']] = p
-current_packages[p['name']] = p
-
-u = {}   
-# only update packages that are currently installed
-# since an applicable errata may only contain some packages
-# that actually apply. aka kernel. Fun fun fun. 
-
-if len(packagelist[0])  4:
-# Newer sats send down arch, filter using name+arch
-for p in packagelist:
-	if current_packages_with_arch.has_key(p[0]+p[4]):
-	u[p[0]+p[4]] = p
-	elif current_packages_with_arch.has_key(p[0]+noarch):
-	u[p[0]+p[4]] = p
-	elif p[4] == noarch and current_packages.has_key(p[0]):
-	u[p[0]] = p
-else:
-# 5.2 and older sats + hosted dont send arch
-for p in packagelist:
-if current_packages.has_key(p[0]):
-u[p[0]] = p
-
-
-# XXX: Fix me - once we keep all errata packages around,
-# this is the WRONG thing to do - we want to keep the specific versions
-# that the user has asked for.
-packagelist = map(lambda a: 

[Spacewalk-devel] [Proposal] Schema change of rhnServerInterface due IPv6

2011-10-18 Thread Miroslav Suchý
I recently changed rhnServerNetwork due IPv6 and it was quite straight.

Now I focused on rhnServerInterface and I want to give you chance to
argue with me, before I do the change. :)

Today the table looks like:
http://spacewalk.redhat.com/documentation/schema-doc/table-RHNSERVERNETINTERFACE.html

It has columns:
* SERVER_ID NUMBER(38)
* NAME  VARCHAR2(32)
IP_ADDR VARCHAR2(64)
NETMASK VARCHAR2(64)
BROADCAST   VARCHAR2(64)
HW_ADDR VARCHAR2(18)
MODULE  VARCHAR2(128)
CREATED DATE
MODIFIEDDATE

* marks primary key

Previusly clients send over XMLRPC this data:

intDict[interface] = {'hwaddr':hwaddr,
  'ipaddr':ipaddr,
  'netmask':netmask,
  'broadcast':broadcast,
  'module': module
  }

for some time (since 2010-11-20) it send:

intDict[interface] = {'hwaddr':hwaddr,
  'ipaddr':ipaddr,
  'netmask':netmask,
  'broadcast':broadcast,
  'module': module,
  'ipv6': ip6_list}

where ip6_list is:

ip6_list.append({
'scope':   ip6.scope,
'addr':ip6.address,
'netmask': ip6.netmask
})

The ipv6 key/value pair is ignored by server for now.
The IPv6 stuff will not fit into current table so I come with following
solution:

Simplify table rhnServerInterface to columns:
* SERVER_ID NUMBER(38)
* NAME  VARCHAR2(32)
HW_ADDR VARCHAR2(18)
MODULE  VARCHAR2(128)
CREATED DATE
MODIFIEDDATE

Create new table rhnServerInterfaceIPv4 with columns:
* SERVER_ID NUMBER(38)
* NAME  VARCHAR2(32)
IP_ADDR VARCHAR2(64)
NETMASK VARCHAR2(64)
BROADCAST   VARCHAR2(64)
CREATED DATE
MODIFIEDDATE
Migration of existing data from rhnServerInterface to this new table is
easy and should not be problem.

Create new table rhnServerInterfaceIPv6 with columns:
* SERVER_ID NUMBER(38)
* NAME  VARCHAR2(32)
SCOPE   VARCHAR2(19)
ADDRVARCHAR2(45)
NETMASK VARCHAR2(49)
CREATED DATE
MODIFIEDDATE

SCOPE can be (according rfc2373):
scop is a 4-bit multicast scope value used to limit the scope of
  the multicast group.  The values are:

 0  reserved
 1  node-local scope
 2  link-local scope
 3  (unassigned)
 4  (unassigned)
 5  site-local scope
 6  (unassigned)
 7  (unassigned)
 8  organization-local scope
 9  (unassigned)
 A  (unassigned)
 B  (unassigned)
 C  (unassigned)

longest is organization-local with 19 chars, but I seen more different
strings already (local, universe etc.).
So I tend to think that more general VARCHAR(128) would be better here.

ADDR - longest IPv6 address can be 45 character wide. While we may
normalize the address and make it shorter. Question is whether we want
it normalize here or exactly as we get it over wire.

NETMASK - it is addr plus /128 as longest prefix.

Comments?

-- 
Miroslav Suchy
Red Hat Satellite Engineering

___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel


Re: [Spacewalk-devel] erratas and the client plugin package action

2011-10-18 Thread Miroslav Suchý
On 10/18/2011 04:53 PM, Ionuț Arțăriși wrote:
 Can we still move errata.py to yum-rhn-plugin? We've gone with the
 second option until now, but this would make packaging cleaner.

Still no objections.

-- 
Miroslav Suchy
Red Hat Satellite Engineering

___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Re: [Spacewalk-devel] erratas and the client plugin package action

2011-10-18 Thread Ionuț Arțăriși

On 10/18/2011 05:17 PM, Miroslav Suchý wrote:

On 10/18/2011 04:53 PM, Ionuț Arțăriși wrote:

Can we still move errata.py to yum-rhn-plugin? We've gone with the
second option until now, but this would make packaging cleaner.

Still no objections.

Cool. So can you apply the patch that I attached to my previous email?

Thanks,
-Ionuț

___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel