MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / sandbox_policy_set_global

Function sandbox_policy_set_global

crates/openshell-cli/src/run.rs:6285–6331  ·  view source on GitHub ↗
(
    server: &str,
    policy_path: &str,
    yes: bool,
    wait: bool,
    _timeout_secs: u64,
    tls: &TlsOptions,
)

Source from the content-addressed store, hash-verified

6283}
6284
6285pub async fn sandbox_policy_set_global(
6286 server: &str,
6287 policy_path: &str,
6288 yes: bool,
6289 wait: bool,
6290 _timeout_secs: u64,
6291 tls: &TlsOptions,
6292) -> Result<()> {
6293 if wait {
6294 return Err(miette::miette!(
6295 "--wait is only supported for sandbox-scoped policy updates"
6296 ));
6297 }
6298
6299 confirm_global_setting_takeover("policy", yes)?;
6300
6301 let policy = load_sandbox_policy(Some(policy_path))?
6302 .ok_or_else(|| miette::miette!("No policy loaded from {policy_path}"))?;
6303
6304 let mut client = grpc_client(server, tls).await?;
6305 let response = client
6306 .update_config(UpdateConfigRequest {
6307 name: String::new(),
6308 policy: Some(policy),
6309 setting_key: String::new(),
6310 setting_value: None,
6311 delete_setting: false,
6312 global: true,
6313 merge_operations: vec![],
6314 expected_resource_version: 0,
6315 })
6316 .await
6317 .into_diagnostic()?
6318 .into_inner();
6319
6320 eprintln!(
6321 "{} Global policy configured (hash: {}, settings revision: {})",
6322 "✓".green().bold(),
6323 if response.policy_hash.len() >= 12 {
6324 &response.policy_hash[..12]
6325 } else {
6326 &response.policy_hash
6327 },
6328 response.settings_revision,
6329 );
6330 Ok(())
6331}
6332
6333pub async fn sandbox_settings_get(
6334 server: &str,

Callers 1

mainFunction · 0.85

Calls 4

grpc_clientFunction · 0.85
load_sandbox_policyFunction · 0.70
update_configMethod · 0.45

Tested by

no test coverage detected