1
0
Fork 0
mirror of https://github.com/containers/youki synced 2024-05-05 15:16:16 +02:00

Merge pull request #305 from YJDoc2/make_id_nonempty

Forbid empty string values for container id in commands
This commit is contained in:
utam0k 2021-09-19 00:06:34 +09:00 committed by GitHub
commit 74ed6304cd
Signed by: GitHub
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 11 additions and 0 deletions

View File

@ -23,6 +23,7 @@ pub struct Create {
#[clap(long, default_value = "0")]
preserve_fds: i32,
/// name of the container instance to be started
#[clap(forbid_empty_values = true, required = true)]
pub container_id: String,
}

View File

@ -13,6 +13,7 @@ use nix::sys::signal as nix_signal;
#[derive(Clap, Debug)]
pub struct Delete {
#[clap(forbid_empty_values = true, required = true)]
container_id: String,
/// forces deletion of the container if it is still running (using SIGKILL)
#[clap(short, long)]

View File

@ -16,6 +16,7 @@ pub struct Events {
#[clap(long)]
pub stats: bool,
/// Name of the container instance
#[clap(forbid_empty_values = true, required = true)]
pub container_id: String,
}

View File

@ -30,6 +30,7 @@ pub struct Exec {
#[clap(short, long)]
pub detach: bool,
/// Identifier of the container
#[clap(forbid_empty_values = true, required = true)]
pub container_id: String,
/// Command that should be executed in the container
#[clap(required = false)]

View File

@ -12,6 +12,7 @@ use crate::{
#[derive(Clap, Debug)]
pub struct Kill {
#[clap(forbid_empty_values = true, required = true)]
container_id: String,
signal: String,
}

View File

@ -14,6 +14,7 @@ use cgroups::common::FreezerState;
/// Structure to implement pause command
#[derive(Clap, Debug)]
pub struct Pause {
#[clap(forbid_empty_values = true, required = true)]
pub container_id: String,
}

View File

@ -10,6 +10,7 @@ pub struct Ps {
/// format to display processes: table or json (default: "table")
#[clap(short, long, default_value = "table")]
format: String,
#[clap(forbid_empty_values = true, required = true)]
pub container_id: String,
/// options will be passed to the ps utility
#[clap(setting = clap::ArgSettings::Last)]

View File

@ -14,6 +14,7 @@ use cgroups::common::FreezerState;
/// Structure to implement resume command
#[derive(Clap, Debug)]
pub struct Resume {
#[clap(forbid_empty_values = true, required = true)]
pub container_id: String,
}

View File

@ -22,6 +22,7 @@ pub struct Run {
#[clap(long, default_value = "0")]
preserve_fds: i32,
/// name of the container instance to be started
#[clap(forbid_empty_values = true, required = true)]
pub container_id: String,
}

View File

@ -12,6 +12,7 @@ use crate::notify_socket::{NotifySocket, NOTIFY_FILE};
#[derive(Clap, Debug)]
pub struct Start {
#[clap(forbid_empty_values = true, required = true)]
pub container_id: String,
}

View File

@ -8,6 +8,7 @@ use crate::container::Container;
#[derive(Clap, Debug)]
pub struct State {
#[clap(forbid_empty_values = true, required = true)]
pub container_id: String,
}