IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
ソースを参照

Added focker image prune

tags/0.92
コミット
d65a623b2b
2個のファイルの変更25行の追加1行の削除
  1. +5
    -1
      focker.py
  2. +20
    -0
      image.py

+ 5
- 1
focker.py ファイルの表示

@@ -4,7 +4,8 @@ import os
# from weir import zfs, process
from .image import command_image_build, \
command_image_untag, \
command_image_list
command_image_list, \
command_image_prune
import sys
from .zfs import zfs_init
from .jail import command_jail_run
@@ -28,6 +29,9 @@ def create_parser():
parser.set_defaults(func=command_image_list)
parser.add_argument('--full-sha256', '-f', action='store_true')
parser = subparsers.add_parser('prune')
parser.set_defaults(func=command_image_prune)
subparsers = subparsers_top.add_parser('jail').add_subparsers()
parser = subparsers.add_parser('run')
parser.set_defaults(func=command_jail_run)


+ 20
- 0
image.py ファイルの表示

@@ -88,3 +88,23 @@ def command_image_list(args):
a[2] if args.full_sha256 else a[2][:7],
a[4].split('/')[-1].split('@')[0] ], lst))
print(tabulate(lst, headers=['Tags', 'Size', 'SHA256', 'Base']))
def command_image_prune(args):
again = True
while again:
again = False
lst = zfs_parse_output(['zfs', 'list', '-o', 'focker:sha256,focker:tags,origin,name', '-H'])
used = set()
for r in lst:
if r[2] == '-':
continue
used.add(r[2].split('@')[0])
for r in lst:
if r[0] == '-' or r[1] != '-':
continue
if r[3] not in used:
print('Removing:', r[3])
zfs_run(['zfs', 'destroy', '-f', r[3]])
again = True
# zfs_parse_output(['zfs'])

読み込み中…
キャンセル
保存