mirror of
https://github.com/YunoHost/package_check.git
synced 2024-09-03 20:06:20 +02:00
Implement ynh_lxc_status
This commit is contained in:
parent
3ac9db3cc1
commit
3d6c925048
1 changed files with 20 additions and 0 deletions
20
lib/ynh_lxd
20
lib/ynh_lxd
|
@ -26,6 +26,26 @@ ynh_lxc_exists () {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Return LXC container status
|
||||||
|
#
|
||||||
|
# usage: ynh_lxc_status --name=name
|
||||||
|
# | arg: -n, --name= - name of the LXC
|
||||||
|
#
|
||||||
|
# Requires YunoHost version *.*.* or higher.
|
||||||
|
ynh_lxc_status () {
|
||||||
|
# Declare an array to define the options of this helper.
|
||||||
|
local legacy_args=n
|
||||||
|
local -A args_array=([n]=name=)
|
||||||
|
local name
|
||||||
|
# Manage arguments with getopts
|
||||||
|
ynh_handle_getopts_args "$@"
|
||||||
|
|
||||||
|
if ynh_lxc_exists --name=$name
|
||||||
|
then
|
||||||
|
lxc list --format json | jq -r --arg name $name '.[] | select(.name==$name) | .state | .status'
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Stopping an LXC container
|
# Stopping an LXC container
|
||||||
#
|
#
|
||||||
# usage: ynh_lxc_stop --name=name
|
# usage: ynh_lxc_stop --name=name
|
||||||
|
|
Loading…
Add table
Reference in a new issue