src/config/remote.rs: add fingerprint
This commit is contained in:
parent
dcb8db66d9
commit
6afbe1d846
@ -50,6 +50,10 @@ pub fn list_remotes(
|
||||
password: {
|
||||
schema: remote::REMOTE_PASSWORD_SCHEMA,
|
||||
},
|
||||
fingerprint: {
|
||||
optional: true,
|
||||
schema: CERT_FINGERPRINT_SHA256_SCHEMA,
|
||||
},
|
||||
},
|
||||
},
|
||||
)]
|
||||
@ -118,6 +122,10 @@ pub fn read_remote(name: String) -> Result<Value, Error> {
|
||||
optional: true,
|
||||
schema: remote::REMOTE_PASSWORD_SCHEMA,
|
||||
},
|
||||
fingerprint: {
|
||||
optional: true,
|
||||
schema: CERT_FINGERPRINT_SHA256_SCHEMA,
|
||||
},
|
||||
digest: {
|
||||
optional: true,
|
||||
schema: PROXMOX_CONFIG_DIGEST_SCHEMA,
|
||||
@ -132,6 +140,7 @@ pub fn update_remote(
|
||||
host: Option<String>,
|
||||
userid: Option<String>,
|
||||
password: Option<String>,
|
||||
fingerprint: Option<String>,
|
||||
digest: Option<String>,
|
||||
) -> Result<(), Error> {
|
||||
|
||||
@ -158,6 +167,9 @@ pub fn update_remote(
|
||||
if let Some(userid) = userid { data.userid = userid; }
|
||||
if let Some(password) = password { data.password = password; }
|
||||
|
||||
// fixme: howto delete a fingeprint?
|
||||
if let Some(fingerprint) = fingerprint { data.fingerprint = Some(fingerprint); }
|
||||
|
||||
config.set_data(&name, "remote", &data)?;
|
||||
|
||||
remote::save_config(&config)?;
|
||||
|
@ -476,7 +476,9 @@ pub fn complete_remote_datastore_name(_arg: &str, param: &HashMap<String, String
|
||||
let client = HttpClient::new(
|
||||
&remote.host,
|
||||
&remote.userid,
|
||||
Some(remote.password)
|
||||
Some(remote.password),
|
||||
remote.fingerprint,
|
||||
false,
|
||||
)?;
|
||||
|
||||
let mut rt = tokio::runtime::Runtime::new().unwrap();
|
||||
|
@ -35,6 +35,10 @@ pub const REMOTE_PASSWORD_SCHEMA: Schema = StringSchema::new("Password or auth t
|
||||
password: {
|
||||
schema: REMOTE_PASSWORD_SCHEMA,
|
||||
},
|
||||
fingerprint: {
|
||||
optional: true,
|
||||
schema: CERT_FINGERPRINT_SHA256_SCHEMA,
|
||||
},
|
||||
}
|
||||
)]
|
||||
#[derive(Serialize,Deserialize)]
|
||||
@ -45,6 +49,7 @@ pub struct Remote {
|
||||
pub host: String,
|
||||
pub userid: String,
|
||||
pub password: String,
|
||||
pub fingerprint: Option<String>,
|
||||
}
|
||||
|
||||
fn init() -> SectionConfig {
|
||||
|
Loading…
Reference in New Issue
Block a user