mirror of
https://git.proxmox.com/git/proxmox
synced 2025-04-30 04:14:51 +00:00
dns-api: remove lazy-static dependency
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
This commit is contained in:
parent
9f9f736cfc
commit
9693ceca7a
@ -7,11 +7,11 @@ license.workspace = true
|
|||||||
repository.workspace = true
|
repository.workspace = true
|
||||||
exclude.workspace = true
|
exclude.workspace = true
|
||||||
description = "DNS Management API implementation"
|
description = "DNS Management API implementation"
|
||||||
|
rust-version.workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow.workspace = true
|
anyhow.workspace = true
|
||||||
const_format.workspace = true
|
const_format.workspace = true
|
||||||
lazy_static.workspace = true
|
|
||||||
regex.workspace = true
|
regex.workspace = true
|
||||||
serde = { workspace = true, features = ["derive"] }
|
serde = { workspace = true, features = ["derive"] }
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
use std::sync::Arc;
|
use std::sync::{Arc, LazyLock, Mutex};
|
||||||
use std::sync::Mutex;
|
|
||||||
|
|
||||||
use anyhow::Error;
|
use anyhow::Error;
|
||||||
use const_format::concatcp;
|
use const_format::concatcp;
|
||||||
use lazy_static::lazy_static;
|
|
||||||
use proxmox_config_digest::ConfigDigest;
|
use proxmox_config_digest::ConfigDigest;
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
|
|
||||||
@ -34,11 +32,10 @@ pub fn read_etc_resolv_conf(
|
|||||||
|
|
||||||
let data = String::from_utf8(raw)?;
|
let data = String::from_utf8(raw)?;
|
||||||
|
|
||||||
lazy_static! {
|
static DOMAIN_REGEX: LazyLock<Regex> =
|
||||||
static ref DOMAIN_REGEX: Regex = Regex::new(r"^\s*(?:search|domain)\s+(\S+)\s*").unwrap();
|
LazyLock::new(|| Regex::new(r"^\s*(?:search|domain)\s+(\S+)\s*").unwrap());
|
||||||
static ref SERVER_REGEX: Regex =
|
static SERVER_REGEX: LazyLock<Regex> =
|
||||||
Regex::new(concatcp!(r"^\s*nameserver\s+(", IPRE_STR, r")\s*")).unwrap();
|
LazyLock::new(|| Regex::new(concatcp!(r"^\s*nameserver\s+(", IPRE_STR, r")\s*")).unwrap());
|
||||||
}
|
|
||||||
|
|
||||||
let mut options = String::new();
|
let mut options = String::new();
|
||||||
|
|
||||||
@ -78,9 +75,7 @@ pub fn update_dns(
|
|||||||
delete: Option<Vec<DeletableResolvConfProperty>>,
|
delete: Option<Vec<DeletableResolvConfProperty>>,
|
||||||
digest: Option<ConfigDigest>,
|
digest: Option<ConfigDigest>,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
lazy_static! {
|
static MUTEX: LazyLock<Arc<Mutex<()>>> = LazyLock::new(|| Arc::new(Mutex::new(())));
|
||||||
static ref MUTEX: Arc<Mutex<()>> = Arc::new(Mutex::new(()));
|
|
||||||
}
|
|
||||||
|
|
||||||
let _guard = MUTEX.lock();
|
let _guard = MUTEX.lock();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user