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'])

불러오는 중...
취소
저장