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 remove

tags/0.92
父節點
當前提交
cba11b75c0
共有 2 個文件被更改,包括 23 次插入1 次删除
  1. +9
    -1
      focker.py
  2. +14
    -0
      image.py

+ 9
- 1
focker.py 查看文件

@@ -5,7 +5,8 @@ import os
from .image import command_image_build, \
command_image_untag, \
command_image_list, \
command_image_prune
command_image_prune, \
command_image_remove
import sys
from .zfs import zfs_init
from .jail import command_jail_run
@@ -32,6 +33,12 @@ def create_parser():
parser = subparsers.add_parser('prune')
parser.set_defaults(func=command_image_prune)
parser = subparsers.add_parser('remove')
parser.set_defaults(func=command_image_remove)
parser.add_argument('reference', type=str)
# parser.add_argument('--remove-children', '-r', action='store_true')
parser.add_argument('--remove-dependents', '-R', action='store_true')
subparsers = subparsers_top.add_parser('jail').add_subparsers()
parser = subparsers.add_parser('run')
parser.set_defaults(func=command_jail_run)
@@ -49,5 +56,6 @@ def main():
sys.exit('You must choose a mode')
args.func(args)
if __name__ == '__main__':
main()

+ 14
- 0
image.py 查看文件

@@ -4,6 +4,7 @@ import yaml
from .steps import create_step
from .snapshot import new_snapshot
from tabulate import tabulate
import subprocess
def process_step(step, name):
@@ -108,3 +109,16 @@ def command_image_prune(args):
zfs_run(['zfs', 'destroy', '-f', r[3]])
again = True
# zfs_parse_output(['zfs'])
def command_image_remove(args):
snap, snap_sha256 = zfs_snapshot_by_tag_or_sha256(args.reference)
ds = snap.split('@')[0]
command = ['zfs', 'destroy', '-r']
#if args.remove_children:
# command.append('-r')
if args.remove_dependents:
command.append('-R')
command.append(ds)
subprocess.run(command)
# zfs_run(['zfs', 'destroy', ds])

Loading…
取消
儲存