Skip to content

Commit 2656580

Browse files
committed
Extend Publish class
Add method to replace a snapshot by another snapshot Add method to create a snapshot from packages
1 parent feed6b5 commit 2656580

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

aptly/publisher/__init__.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,33 @@ def compare(self, other, components=[]):
282282

283283
return (diff, equal)
284284

285+
def replace_snapshot(self, component, new_snapshot):
286+
newlist = []
287+
if component in self.components.keys():
288+
for snapshot in self.publish_snapshots:
289+
if snapshot["Name"] not in self.components[component] and snapshot not in newlist:
290+
newlist.append(snapshot)
291+
else:
292+
newlist = self.publish_snapshots
293+
newlist.append({
294+
'Component': component,
295+
'Name': new_snapshot
296+
})
297+
298+
self.components[component] = [new_snapshot]
299+
self.publish_snapshots = newlist
300+
301+
def create_snapshot_from_packages(self, packages, name, description):
302+
self.client.do_post(
303+
'/snapshots',
304+
data={
305+
'Name': name,
306+
'SourceSnapshots': [],
307+
'Description': description,
308+
'PackageRefs': packages,
309+
}
310+
)
311+
285312
@staticmethod
286313
@CachedMethod
287314
def _get_packages(client, source_type, source_name):

0 commit comments

Comments
 (0)