mirror of
https://github.com/YunoHost/package_check.git
synced 2024-09-03 20:06:20 +02:00
Implement ynh_lxc_snapshot_delete
This commit is contained in:
parent
f35d08db03
commit
fc3d11791e
1 changed files with 25 additions and 0 deletions
25
lib/ynh_lxd
25
lib/ynh_lxd
|
@ -415,6 +415,31 @@ ynh_lxc_snapshot_create () {
|
|||
fi
|
||||
}
|
||||
|
||||
# Delete a snapshot of an LXC container
|
||||
#
|
||||
# usage: ynh_lxc_snapshot_delete --name=name --snapname=snapname
|
||||
# | arg: -n, --name= - name of the LXC
|
||||
# | arg: -s, --snapname= - name of the snapshot
|
||||
#
|
||||
# Requires YunoHost version *.*.* or higher.
|
||||
ynh_lxc_snapshot_delete () {
|
||||
# Declare an array to define the options of this helper.
|
||||
local legacy_args=ns
|
||||
local -A args_array=([n]=name= [s]=snapname=)
|
||||
local name
|
||||
local snapname
|
||||
# Manage arguments with getopts
|
||||
ynh_handle_getopts_args "$@"
|
||||
|
||||
if ynh_lxc_snapshot_exists --name="$name" --snapname="$snapname"
|
||||
then
|
||||
lxc delete $name/$snapname
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Load a snapshot of an LXC container
|
||||
#
|
||||
# usage: ynh_lxc_snapshot_load --name=name --snapname=snapname
|
||||
|
|
Loading…
Add table
Reference in a new issue