src/config/remote.rs: add fingerprint

This commit is contained in:
Dietmar Maurer
2020-01-25 09:48:39 +01:00
parent dcb8db66d9
commit 6afbe1d846
3 changed files with 20 additions and 1 deletions

View File

@ -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)?;