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!
Parcourir la source

Proper handling to add tags

tags/0.92
Stanislaw Adaszewski il y a 4 ans
Parent
révision
1336e5a08c
1 fichiers modifiés avec 6 ajouts et 1 suppressions
  1. +6
    -1
      zfs.py

+ 6
- 1
zfs.py Voir le fichier

@@ -73,6 +73,10 @@ def zfs_snapshot_by_sha256(sha256):
def zfs_tag(name, tags):
lst = zfs_parse_output(['zfs', 'list', '-o', 'focker:tags', '-H', name])
tags = list(tags)
tags.extend(lst[0][0].split(' '))
tags = list(set(tags))
if len(tags) > 0:
zfs_run(['zfs', 'set', 'focker:tags=' + ' '.join(tags), name])
else:
@@ -85,7 +89,8 @@ def zfs_untag(tags):
for row in lst:
cur_tags = row[1].split(' ')
for t in tags:
cur_tags.remove(t)
if t in cur_tags:
cur_tags.remove(t)
zfs_tag(row[0], cur_tags)


Chargement…
Annuler
Enregistrer