1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 from pulp.server.api.base import BaseApi
17 from pulp.server.auditing import audit
18 from pulp.server.db import model
19 from pulp.server.db.connection import get_object_db
20
21
22 errata_fields = model.Errata(None, None, None, None, None, None).keys()
26
29
30 @property
32 return ["title", "description", "version", "release", "type", "status",
33 "updated", "issued", "pushcount", "from_str",
34 "reboot_suggested"]
35
40
41 @audit(params=["id", "title", "type"])
42 - def create(self, id, title, description, version, release, type,
43 status="", updated="", issued="", pushcount="", from_str="",
44 reboot_suggested="", references=(), pkglist=(),
45 repo_defined=False, immutable=False):
46 """
47 Create a new Errata object and return it
48 """
49 e = model.Errata(id, title, description, version, release, type,
50 status, updated, issued, pushcount, from_str,
51 reboot_suggested, references, pkglist, repo_defined,
52 immutable)
53 self.insert(e)
54 return e
55
56 @audit()
58 """
59 Delete package version object based on "_id" key
60 """
61 super(ErrataApi, self).delete(id=id)
62
63 @audit()
65 """
66 Updates an errata object in the database
67 """
68 return super(ErrataApi, self).update(errata)
69
71 """
72 Return a single Errata object based on the id
73 """
74 return self.objectdb.find_one({'id': id})
75
76 - def errata(self, id=None, title=None, description=None, version=None,
77 release=None, type=None, status=None, updated=None, issued=None,
78 pushcount=None, from_str=None, reboot_suggested=None):
79 """
80 Return a list of all errata objects matching search terms
81 """
82 searchDict = {}
83 if id:
84 searchDict['id'] = id
85 if title:
86 searchDict['title'] = title
87 if description:
88 searchDict['description'] = description
89 if version:
90 searchDict['version'] = version
91 if release:
92 searchDict['release'] = release
93 if type:
94 searchDict['type'] = type
95 if status:
96 searchDict['status'] = status
97 if updated:
98 searchDict['updated'] = updated
99 if issued:
100 searchDict['issued'] = issued
101 if pushcount:
102 searchDict['pushcount'] = pushcount
103 if from_str:
104 searchDict['from_str'] = from_str
105 if reboot_suggested:
106 searchDict['reboot_suggested'] = reboot_suggested
107 if (len(searchDict.keys()) == 0):
108 return list(self.objectdb.find())
109 else:
110 return list(self.objectdb.find(searchDict))
111
113 """
114 Search for errata that are associated with specified package info
115 """
116 pass
117
120
123
126
128 """
129 Search Errata for all matches of this reference with id 'refid'
130 @param type: reference type to search, example 'bugzilla', 'cve'
131 @param refid: id to match on
132 """
133
134
135
136 all_errata = self.errata()
137 matches = []
138 for e in all_errata:
139 for ref in e["references"]:
140 if ref["type"] == type and ref["id"] == refid:
141 matches.append(e["id"])
142 continue
143 return matches
144
146 """
147 Goal is to return the repoid's of repos that contain this errata
148 """
149 pass
150