Re: [Spacewalk-devel] [PATCH] extend API call errata.setDetails to support issue_date and update_date

2012-11-15 Thread Jan Pazdziora
On Thu, Nov 15, 2012 at 06:37:37PM +0100, Tomas Lestach wrote:
> On Wednesday 14 of November 2012 16:09:59 Jörg Steffens wrote:
> > 
> > currently, the API allows to create and modify most attributes of
> > erratas, but the functionality for setting the issue- and update-date is
> > missing.
> > 
> > The first attached patch adds this functionality to the API call
> > errate.setDetails.
> 
> I committed both patches to spacewalk.
> 
> http://git.fedorahosted.org/cgit/spacewalk.git/commit/?id=4d2c9204d5e91e0ed76060a47ac8d3e1c6e84603
> http://git.fedorahosted.org/cgit/spacewalk.git/commit/?id=b0524cc7fa1de90398e8b7d3762555324dd5c4f5

And it broke the checkstyle:

https://koji.spacewalkproject.org/koji/taskinfo?taskID=116265

:-(

-- 
Jan Pazdziora
Principal Software Engineer, Satellite Engineering, Red Hat

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


Re: [Spacewalk-devel] [PATCH] extend API call errata.setDetails to support issue_date and update_date

2012-11-15 Thread Tomas Lestach
On Wednesday 14 of November 2012 16:09:59 Jörg Steffens wrote:
> Hi,
> 
> currently, the API allows to create and modify most attributes of
> erratas, but the functionality for setting the issue- and update-date is
> missing.
> 
> The first attached patch adds this functionality to the API call
> errate.setDetails.
> 
> The second patch integrates this to scripts/clone-errata/rhn-clone-errata.py
> 
> It would be great, if those patches could get applied.
> 
> regards,
> Jörg Steffens

Hello Jörg,

I committed both patches to spacewalk.

http://git.fedorahosted.org/cgit/spacewalk.git/commit/?id=4d2c9204d5e91e0ed76060a47ac8d3e1c6e84603
http://git.fedorahosted.org/cgit/spacewalk.git/commit/?id=b0524cc7fa1de90398e8b7d3762555324dd5c4f5

Thank you.
Regards,
-- 
Tomas Lestach
RHN Satellite Engineering

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


[Spacewalk-devel] [PATCH] extend API call errata.setDetails to support issue_date and update_date

2012-11-14 Thread Jörg Steffens
Hi,

currently, the API allows to create and modify most attributes of
erratas, but the functionality for setting the issue- and update-date is
missing.

The first attached patch adds this functionality to the API call
errate.setDetails.

The second patch integrates this to scripts/clone-errata/rhn-clone-errata.py

It would be great, if those patches could get applied.

regards,
Jörg Steffens
-- 
  Jörg Steffensjoerg.steff...@dass-it.de
  dass IT GmbH Phone: +49.221.3565666-91
  http://www.dass-IT.de  Fax: +49.221.3565666-10

 Sitz der Gesellschaft: Köln | Amtsgericht Köln: HRB52500
 Geschäftsführer: S. Dühr, M. Außendorf, Jörg Steffens, P. Storz
>From b5b0edbe7065f86acb59c6c3887025a3680fa337 Mon Sep 17 00:00:00 2001
From: Joerg Steffens 
Date: Wed, 14 Nov 2012 15:48:24 +0100
Subject: [PATCH 1/2] extend API call errata.setDetails to support issue_date
 and update_date

---
 .../rhn/frontend/xmlrpc/errata/ErrataHandler.java  |   12 
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/errata/ErrataHandler.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/errata/ErrataHandler.java
index d18c076..686e19b 100644
--- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/errata/ErrataHandler.java
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/errata/ErrataHandler.java
@@ -281,6 +281,8 @@ public class ErrataHandler extends BaseHandler {
  *  following: 'Security Advisory', 'Product Enhancement Advisory',
  *  or 'Bug Fix Advisory'")
  *  #prop("string", "product")
+ *  #prop("dateTime.iso8601", "issue_date")
+ *  #prop("dateTime.iso8601", "update_date")
  *  #prop("string", "errataFrom")
  *  #prop("string", "topic")
  *  #prop("string", "description")
@@ -323,6 +325,8 @@ public class ErrataHandler extends BaseHandler {
 validKeys.add("advisory_release");
 validKeys.add("advisory_type");
 validKeys.add("product");
+validKeys.add("issue_date");
+validKeys.add("update_date");
 validKeys.add("errataFrom");
 validKeys.add("topic");
 validKeys.add("description");
@@ -348,6 +352,14 @@ public class ErrataHandler extends BaseHandler {
 }
 }
 
+if (details.containsKey("issue_date")) {
+errata.setIssueDate( new Date((String)details.get("issue_date")));
+}
+
+if (details.containsKey("update_date")) {
+errata.setUpdateDate( new Date((String)details.get("update_date")));
+}
+
 if (details.containsKey("synopsis")) {
 errata.setSynopsis((String)details.get("synopsis"));
 }
-- 
1.7.7

>From e73bf6f6df3bd0bb120b929f9db790a4f61f99c6 Mon Sep 17 00:00:00 2001
From: Joerg Steffens 
Date: Wed, 14 Nov 2012 15:59:58 +0100
Subject: [PATCH 2/2] clone also issue_ and update_date of erratas

---
 scripts/clone-errata/rhn-clone-errata.py |   18 ++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/scripts/clone-errata/rhn-clone-errata.py b/scripts/clone-errata/rhn-clone-errata.py
index b38c6a5..80a700e 100755
--- a/scripts/clone-errata/rhn-clone-errata.py
+++ b/scripts/clone-errata/rhn-clone-errata.py
@@ -827,6 +827,24 @@ def main():
 else:
 print "\tErrata Created: %d" % spwErrObject['id']
 
+try:
+if spwErrDetails['errata_issue_date']:
+mySPW.setDetails(spwErrataName, { 'issue_date' : spwErrDetails['errata_issue_date'] }, 0)
+except Exception as e:
+if options.format:
+print >>sys.stderr, "failed to set issue_date: %s" % e
+else:
+print "failed to set issue_date: %s" % e
+
+try:
+if spwErrDetails['errata_update_date']:
+mySPW.setDetails(spwErrataName, { 'update_date' : spwErrDetails['errata_update_date'] }, 0)
+except Exception as e:
+if options.format:
+print >>sys.stderr, "failed to set update_date: %s" % e
+else:
+print "failed to set update_date: %s" % e
+
 if options.publish:
 spwPublish = mySPW.errataPublish (spwErrataName, [chanMap[chan]], 0)
 if options.format:
-- 
1.7.7

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