group filter: rename CLI/API/Config "groups" option to "group-filter"
we even use that for basically all the related schema names, "groups" allone is just rather not so telling, i.e., "groups" what? While due to the additive nature of `group-filter` is not the best possible name for passing multiple arguments on the CLI (the web-ui can present this more UX-friendly anyway) due to possible confusion about if the filter act like AND vs OR it can be documented and even if a user is confused they still are safe on more being synced than less. Also, the original param name wasn't really _that_ better in that regards Dietmar also suggested to use singular for the CLI option, while there can be more they're passed over repeating the option, each with a single filter. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
efd2713aa8
commit
062edce27f
@ -247,7 +247,7 @@ pub struct VerificationJobStatus {
|
||||
optional: true,
|
||||
type: Userid,
|
||||
},
|
||||
groups: {
|
||||
"group-filter": {
|
||||
schema: GROUP_FILTER_LIST_SCHEMA,
|
||||
optional: true,
|
||||
},
|
||||
@ -270,7 +270,7 @@ pub struct TapeBackupJobSetup {
|
||||
#[serde(skip_serializing_if="Option::is_none")]
|
||||
pub notify_user: Option<Userid>,
|
||||
#[serde(skip_serializing_if="Option::is_none")]
|
||||
pub groups: Option<Vec<GroupFilter>>,
|
||||
pub group_filter: Option<Vec<GroupFilter>>,
|
||||
}
|
||||
|
||||
#[api(
|
||||
@ -409,7 +409,7 @@ pub const GROUP_FILTER_LIST_SCHEMA: Schema = ArraySchema::new("List of group fil
|
||||
optional: true,
|
||||
schema: SYNC_SCHEDULE_SCHEMA,
|
||||
},
|
||||
groups: {
|
||||
"group-filter": {
|
||||
schema: GROUP_FILTER_LIST_SCHEMA,
|
||||
optional: true,
|
||||
},
|
||||
@ -433,7 +433,7 @@ pub struct SyncJobConfig {
|
||||
#[serde(skip_serializing_if="Option::is_none")]
|
||||
pub schedule: Option<String>,
|
||||
#[serde(skip_serializing_if="Option::is_none")]
|
||||
pub groups: Option<Vec<GroupFilter>>,
|
||||
pub group_filter: Option<Vec<GroupFilter>>,
|
||||
}
|
||||
|
||||
#[api(
|
||||
|
@ -192,8 +192,8 @@ pub enum DeletableProperty {
|
||||
schedule,
|
||||
/// Delete the remove-vanished flag.
|
||||
remove_vanished,
|
||||
/// Delete the groups property.
|
||||
groups,
|
||||
/// Delete the group_filter property.
|
||||
group_filter,
|
||||
}
|
||||
|
||||
#[api(
|
||||
@ -256,7 +256,7 @@ pub fn update_sync_job(
|
||||
DeletableProperty::comment => { data.comment = None; },
|
||||
DeletableProperty::schedule => { data.schedule = None; },
|
||||
DeletableProperty::remove_vanished => { data.remove_vanished = None; },
|
||||
DeletableProperty::groups => { data.groups = None; },
|
||||
DeletableProperty::group_filter => { data.group_filter = None; },
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -274,7 +274,7 @@ pub fn update_sync_job(
|
||||
if let Some(remote) = update.remote { data.remote = remote; }
|
||||
if let Some(remote_store) = update.remote_store { data.remote_store = remote_store; }
|
||||
if let Some(owner) = update.owner { data.owner = Some(owner); }
|
||||
if let Some(groups) = update.groups { data.groups = Some(groups); }
|
||||
if let Some(group_filter) = update.group_filter { data.group_filter = Some(group_filter); }
|
||||
|
||||
let schedule_changed = data.schedule != update.schedule;
|
||||
if update.schedule.is_some() { data.schedule = update.schedule; }
|
||||
@ -394,7 +394,7 @@ acl:1:/remote/remote1/remotestore1:write@pbs:RemoteSyncOperator
|
||||
owner: Some(write_auth_id.clone()),
|
||||
comment: None,
|
||||
remove_vanished: None,
|
||||
groups: None,
|
||||
group_filter: None,
|
||||
schedule: None,
|
||||
};
|
||||
|
||||
|
@ -133,8 +133,8 @@ pub enum DeletableProperty {
|
||||
LatestOnly,
|
||||
/// Delete the 'notify-user' property
|
||||
NotifyUser,
|
||||
/// Delete the 'groups' property
|
||||
Groups,
|
||||
/// Delete the 'group_filter' property
|
||||
GroupFilter,
|
||||
}
|
||||
|
||||
#[api(
|
||||
@ -193,7 +193,7 @@ pub fn update_tape_backup_job(
|
||||
DeletableProperty::NotifyUser => { data.setup.notify_user = None; },
|
||||
DeletableProperty::Schedule => { data.schedule = None; },
|
||||
DeletableProperty::Comment => { data.comment = None; },
|
||||
DeletableProperty::Groups => { data.setup.groups = None; },
|
||||
DeletableProperty::GroupFilter => { data.setup.group_filter = None; },
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -206,7 +206,7 @@ pub fn update_tape_backup_job(
|
||||
if update.setup.export_media_set.is_some() { data.setup.export_media_set = update.setup.export_media_set; }
|
||||
if update.setup.latest_only.is_some() { data.setup.latest_only = update.setup.latest_only; }
|
||||
if update.setup.notify_user.is_some() { data.setup.notify_user = update.setup.notify_user; }
|
||||
if update.setup.groups.is_some() { data.setup.groups = update.setup.groups; }
|
||||
if update.setup.group_filter.is_some() { data.setup.group_filter = update.setup.group_filter; }
|
||||
|
||||
let schedule_changed = data.schedule != update.schedule;
|
||||
if update.schedule.is_some() { data.schedule = update.schedule; }
|
||||
|
@ -50,7 +50,7 @@ impl TryFrom<&SyncJobConfig> for PullParameters {
|
||||
&sync_job.remote_store,
|
||||
sync_job.owner.as_ref().unwrap_or_else(|| Authid::root_auth_id()).clone(),
|
||||
sync_job.remove_vanished,
|
||||
sync_job.groups.clone(),
|
||||
sync_job.group_filter.clone(),
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -152,7 +152,7 @@ pub fn do_sync_job(
|
||||
schema: REMOVE_VANISHED_BACKUPS_SCHEMA,
|
||||
optional: true,
|
||||
},
|
||||
"groups": {
|
||||
"group-filter": {
|
||||
schema: GROUP_FILTER_LIST_SCHEMA,
|
||||
optional: true,
|
||||
},
|
||||
@ -173,7 +173,7 @@ async fn pull (
|
||||
remote: String,
|
||||
remote_store: String,
|
||||
remove_vanished: Option<bool>,
|
||||
groups: Option<Vec<GroupFilter>>,
|
||||
group_filter: Option<Vec<GroupFilter>>,
|
||||
_info: &ApiMethod,
|
||||
rpcenv: &mut dyn RpcEnvironment,
|
||||
) -> Result<String, Error> {
|
||||
@ -189,7 +189,7 @@ async fn pull (
|
||||
&remote_store,
|
||||
auth_id.clone(),
|
||||
remove_vanished,
|
||||
groups,
|
||||
group_filter,
|
||||
)?;
|
||||
let client = pull_params.client().await?;
|
||||
|
||||
|
@ -437,7 +437,7 @@ fn backup_worker(
|
||||
|
||||
group_list.sort_unstable();
|
||||
|
||||
let (group_list, group_count) = if let Some(group_filters) = &setup.groups {
|
||||
let (group_list, group_count) = if let Some(group_filters) = &setup.group_filter {
|
||||
let filter_fn = |group: &BackupGroup, group_filters: &[GroupFilter]| {
|
||||
group_filters.iter().any(|filter| group.matches(filter))
|
||||
};
|
||||
|
@ -240,7 +240,7 @@ fn task_mgmt_cli() -> CommandLineInterface {
|
||||
schema: REMOVE_VANISHED_BACKUPS_SCHEMA,
|
||||
optional: true,
|
||||
},
|
||||
"groups": {
|
||||
"group-filter": {
|
||||
schema: GROUP_FILTER_LIST_SCHEMA,
|
||||
optional: true,
|
||||
},
|
||||
@ -257,7 +257,7 @@ async fn pull_datastore(
|
||||
remote_store: String,
|
||||
local_store: String,
|
||||
remove_vanished: Option<bool>,
|
||||
groups: Option<Vec<GroupFilter>>,
|
||||
group_filter: Option<Vec<GroupFilter>>,
|
||||
param: Value,
|
||||
) -> Result<Value, Error> {
|
||||
|
||||
@ -271,8 +271,8 @@ async fn pull_datastore(
|
||||
"remote-store": remote_store,
|
||||
});
|
||||
|
||||
if groups.is_some() {
|
||||
args["groups"] = json!(groups);
|
||||
if group_filter.is_some() {
|
||||
args["group-filter"] = json!(group_filter);
|
||||
}
|
||||
|
||||
if let Some(remove_vanished) = remove_vanished {
|
||||
@ -400,7 +400,7 @@ async fn run() -> Result<(), Error> {
|
||||
.completion_cb("local-store", pbs_config::datastore::complete_datastore_name)
|
||||
.completion_cb("remote", pbs_config::remote::complete_remote_name)
|
||||
.completion_cb("remote-store", complete_remote_datastore_name)
|
||||
.completion_cb("groups", complete_remote_datastore_group_filter)
|
||||
.completion_cb("group_filter", complete_remote_datastore_group_filter)
|
||||
)
|
||||
.insert(
|
||||
"verify",
|
||||
|
Loading…
Reference in New Issue
Block a user