update to nix 0.24 / rustyline 9 / proxmox-sys 0.3
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
parent
68a6e970d4
commit
11ca834317
|
@ -61,7 +61,7 @@ hyper = { version = "0.14", features = [ "full" ] }
|
|||
lazy_static = "1.4"
|
||||
libc = "0.2"
|
||||
log = "0.4.17"
|
||||
nix = "0.19.1"
|
||||
nix = "0.24"
|
||||
num-traits = "0.2"
|
||||
once_cell = "1.3.1"
|
||||
openssl = "0.10.38" # currently patched!
|
||||
|
@ -69,7 +69,7 @@ pam = "0.7"
|
|||
pam-sys = "0.5"
|
||||
percent-encoding = "2.1"
|
||||
regex = "1.5.5"
|
||||
rustyline = "7"
|
||||
rustyline = "9"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
siphasher = "0.3"
|
||||
|
@ -104,7 +104,7 @@ proxmox-time = "1.1.2"
|
|||
proxmox-uuid = "1"
|
||||
proxmox-serde = "0.1"
|
||||
proxmox-shared-memory = "0.2"
|
||||
proxmox-sys = { version = "0.2", features = [ "sortable-macro" ] }
|
||||
proxmox-sys = { version = "0.3", features = [ "sortable-macro" ] }
|
||||
proxmox-compression = "0.1"
|
||||
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ Build-Depends: debhelper (>= 12),
|
|||
librust-lazy-static-1+default-dev (>= 1.4-~~),
|
||||
librust-libc-0.2+default-dev,
|
||||
librust-log-0.4+default-dev (>= 0.4.17-~~) <!nocheck>,
|
||||
librust-nix-0.19+default-dev (>= 0.19.1-~~),
|
||||
librust-nix-0.24+default-dev,
|
||||
librust-nom-5+default-dev (>= 5.1-~~),
|
||||
librust-num-traits-0.2+default-dev,
|
||||
librust-once-cell-1+default-dev (>= 1.3.1-~~),
|
||||
|
@ -47,10 +47,10 @@ Build-Depends: debhelper (>= 12),
|
|||
librust-proxmox-borrow-1+default-dev,
|
||||
librust-proxmox-compression-0.1+default-dev (>= 0.1.1-~~),
|
||||
librust-proxmox-fuse-0.1+default-dev (>= 0.1.1-~~),
|
||||
librust-proxmox-http-0.6.1+client-dev,
|
||||
librust-proxmox-http-0.6.1+default-dev,
|
||||
librust-proxmox-http-0.6.1+http-helpers-dev,
|
||||
librust-proxmox-http-0.6.1+websocket-dev,
|
||||
librust-proxmox-http-0.6+client-dev (>= 0.6.1-~~),
|
||||
librust-proxmox-http-0.6+default-dev (>= 0.6.1-~~),
|
||||
librust-proxmox-http-0.6+http-helpers-dev (>= 0.6.1-~~),
|
||||
librust-proxmox-http-0.6+websocket-dev (>= 0.6.1-~~),
|
||||
librust-proxmox-io-1+default-dev (>= 1.0.1-~~),
|
||||
librust-proxmox-io-1+tokio-dev (>= 1.0.1-~~),
|
||||
librust-proxmox-lang-1+default-dev (>= 1.1-~~),
|
||||
|
@ -63,8 +63,9 @@ Build-Depends: debhelper (>= 12),
|
|||
librust-proxmox-section-config-1+default-dev,
|
||||
librust-proxmox-serde-0.1+default-dev,
|
||||
librust-proxmox-shared-memory-0.2+default-dev,
|
||||
librust-proxmox-sys-0.2+default-dev (>= 0.2.1-~~),
|
||||
librust-proxmox-sys-0.2+sortable-macro-dev (>= 0.2.1-~~),
|
||||
librust-proxmox-sys-0.3+default-dev,
|
||||
librust-proxmox-sys-0.3+logrotate-dev,
|
||||
librust-proxmox-sys-0.3+sortable-macro-dev,
|
||||
librust-proxmox-tfa-2+api-dev,
|
||||
librust-proxmox-tfa-2+api-types-dev,
|
||||
librust-proxmox-tfa-2+default-dev,
|
||||
|
@ -74,7 +75,7 @@ Build-Depends: debhelper (>= 12),
|
|||
librust-pxar-0.10+default-dev (>= 0.10.1-~~),
|
||||
librust-pxar-0.10+tokio-io-dev (>= 0.10.1-~~),
|
||||
librust-regex-1+default-dev (>= 1.5.5-~~),
|
||||
librust-rustyline-7+default-dev,
|
||||
librust-rustyline-9+default-dev,
|
||||
librust-serde-1+default-dev,
|
||||
librust-serde-1+derive-dev,
|
||||
librust-serde-cbor-0.11+default-dev (>= 0.11.1-~~),
|
||||
|
|
|
@ -16,12 +16,12 @@ http = "0.2"
|
|||
hyper = { version = "0.14", features = [ "full" ] }
|
||||
lazy_static = "1.4"
|
||||
libc = "0.2"
|
||||
nix = "0.19.1"
|
||||
nix = "0.24"
|
||||
openssl = "0.10"
|
||||
percent-encoding = "2.1"
|
||||
pin-project-lite = "0.2"
|
||||
regex = "1.5"
|
||||
rustyline = "7"
|
||||
rustyline = "9"
|
||||
serde = "1.0"
|
||||
serde_json = "1.0"
|
||||
tokio = { version = "1.6", features = [ "fs", "signal" ] }
|
||||
|
@ -41,7 +41,7 @@ proxmox-lang = "1.1"
|
|||
proxmox-router = { version = "1.2", features = [ "cli" ] }
|
||||
proxmox-schema = "1.3.1"
|
||||
proxmox-time = "1"
|
||||
proxmox-sys = "0.2"
|
||||
proxmox-sys = "0.3"
|
||||
|
||||
pxar = { version = "0.10.1", features = [ "tokio-io" ] }
|
||||
|
||||
|
|
|
@ -329,13 +329,13 @@ impl Archiver {
|
|||
Mode::empty(),
|
||||
) {
|
||||
Ok(fd) => Ok(Some(fd)),
|
||||
Err(nix::Error::Sys(Errno::ENOENT)) => {
|
||||
Err(Errno::ENOENT) => {
|
||||
if existed {
|
||||
self.report_vanished_file()?;
|
||||
}
|
||||
Ok(None)
|
||||
}
|
||||
Err(nix::Error::Sys(Errno::EACCES)) => {
|
||||
Err(Errno::EACCES) => {
|
||||
writeln!(
|
||||
self.errors,
|
||||
"failed to open file: {:?}: access denied",
|
||||
|
@ -343,7 +343,7 @@ impl Archiver {
|
|||
)?;
|
||||
Ok(None)
|
||||
}
|
||||
Err(nix::Error::Sys(Errno::EPERM)) if !noatime.is_empty() => {
|
||||
Err(Errno::EPERM) if !noatime.is_empty() => {
|
||||
// Retry without O_NOATIME:
|
||||
noatime = OFlag::empty();
|
||||
continue;
|
||||
|
@ -899,7 +899,7 @@ fn get_chattr(metadata: &mut Metadata, fd: RawFd) -> Result<(), Error> {
|
|||
|
||||
match unsafe { fs::read_attr_fd(fd, &mut attr) } {
|
||||
Ok(_) => (),
|
||||
Err(nix::Error::Sys(errno)) if errno_is_unsupported(errno) => {
|
||||
Err(errno) if errno_is_unsupported(errno) => {
|
||||
return Ok(());
|
||||
}
|
||||
Err(err) => bail!("failed to read file attributes: {}", err),
|
||||
|
@ -921,7 +921,7 @@ fn get_fat_attr(metadata: &mut Metadata, fd: RawFd, fs_magic: i64) -> Result<(),
|
|||
|
||||
match unsafe { fs::read_fat_attr_fd(fd, &mut attr) } {
|
||||
Ok(_) => (),
|
||||
Err(nix::Error::Sys(errno)) if errno_is_unsupported(errno) => {
|
||||
Err(errno) if errno_is_unsupported(errno) => {
|
||||
return Ok(());
|
||||
}
|
||||
Err(err) => bail!("failed to read fat attributes: {}", err),
|
||||
|
@ -959,10 +959,7 @@ fn get_quota_project_id(
|
|||
|
||||
// On some FUSE filesystems it can happen that ioctl is not supported.
|
||||
// For these cases projid is set to 0 while the error is ignored.
|
||||
if let Err(err) = res {
|
||||
let errno = err
|
||||
.as_errno()
|
||||
.ok_or_else(|| format_err!("error while reading quota project id"))?;
|
||||
if let Err(errno) = res {
|
||||
if errno_is_unsupported(errno) {
|
||||
return Ok(());
|
||||
} else {
|
||||
|
|
|
@ -428,7 +428,7 @@ impl Extractor {
|
|||
if result.seeked_last {
|
||||
while match nix::unistd::ftruncate(file.as_raw_fd(), size as i64) {
|
||||
Ok(_) => false,
|
||||
Err(nix::Error::Sys(errno)) if errno == nix::errno::Errno::EINTR => true,
|
||||
Err(errno) if errno == nix::errno::Errno::EINTR => true,
|
||||
Err(err) => bail!("error setting file size: {}", err),
|
||||
} {}
|
||||
}
|
||||
|
@ -485,7 +485,7 @@ impl Extractor {
|
|||
if result.seeked_last {
|
||||
while match nix::unistd::ftruncate(file.as_raw_fd(), size as i64) {
|
||||
Ok(_) => false,
|
||||
Err(nix::Error::Sys(errno)) if errno == nix::errno::Errno::EINTR => true,
|
||||
Err(errno) if errno == nix::errno::Errno::EINTR => true,
|
||||
Err(err) => bail!("error setting file size: {}", err),
|
||||
} {}
|
||||
}
|
||||
|
|
|
@ -372,7 +372,7 @@ fn apply_chattr(fd: RawFd, chattr: libc::c_long, mask: libc::c_long) -> Result<(
|
|||
let mut fattr: libc::c_long = 0;
|
||||
match unsafe { fs::read_attr_fd(fd, &mut fattr) } {
|
||||
Ok(_) => (),
|
||||
Err(nix::Error::Sys(errno)) if errno_is_unsupported(errno) => {
|
||||
Err(errno) if errno_is_unsupported(errno) => {
|
||||
return Ok(());
|
||||
}
|
||||
Err(err) => bail!("failed to read file attributes: {}", err),
|
||||
|
@ -386,7 +386,7 @@ fn apply_chattr(fd: RawFd, chattr: libc::c_long, mask: libc::c_long) -> Result<(
|
|||
|
||||
match unsafe { fs::write_attr_fd(fd, &attr) } {
|
||||
Ok(_) => Ok(()),
|
||||
Err(nix::Error::Sys(errno)) if errno_is_unsupported(errno) => Ok(()),
|
||||
Err(errno) if errno_is_unsupported(errno) => Ok(()),
|
||||
Err(err) => bail!("failed to set file attributes: {}", err),
|
||||
}
|
||||
}
|
||||
|
@ -400,7 +400,7 @@ fn apply_flags(flags: Flags, fd: RawFd, entry_flags: u64) -> Result<(), Error> {
|
|||
if fatattr != 0 {
|
||||
match unsafe { fs::write_fat_attr_fd(fd, &fatattr) } {
|
||||
Ok(_) => (),
|
||||
Err(nix::Error::Sys(errno)) if errno_is_unsupported(errno) => (),
|
||||
Err(errno) if errno_is_unsupported(errno) => (),
|
||||
Err(err) => bail!("failed to set file FAT attributes: {}", err),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ impl tower_service::Service<Uri> for VsockConnector {
|
|||
)?;
|
||||
|
||||
let sock_addr = VsockAddr::new(cid, port as u32);
|
||||
connect(sock_fd, &SockAddr::Vsock(sock_addr))?;
|
||||
connect(sock_fd, &sock_addr)?;
|
||||
|
||||
// connect sync, but set nonblock after (tokio requires it)
|
||||
let std_stream = unsafe { std::os::unix::net::UnixStream::from_raw_fd(sock_fd) };
|
||||
|
|
|
@ -10,7 +10,7 @@ anyhow = "1.0"
|
|||
hex = "0.4.3"
|
||||
lazy_static = "1.4"
|
||||
libc = "0.2"
|
||||
nix = "0.19.1"
|
||||
nix = "0.24"
|
||||
once_cell = "1.3.1"
|
||||
openssl = "0.10"
|
||||
regex = "1.5"
|
||||
|
@ -24,7 +24,7 @@ proxmox-section-config = "1"
|
|||
proxmox-time = "1"
|
||||
proxmox-serde = "0.1"
|
||||
proxmox-shared-memory = "0.2"
|
||||
proxmox-sys = "0.2"
|
||||
proxmox-sys = "0.3"
|
||||
|
||||
pbs-api-types = { path = "../pbs-api-types" }
|
||||
pbs-buildcfg = { path = "../pbs-buildcfg" }
|
||||
|
|
|
@ -667,7 +667,7 @@ pub fn cached_config() -> Result<Arc<AclTree>, Error> {
|
|||
|
||||
let stat = match nix::sys::stat::stat(ACL_CFG_FILENAME) {
|
||||
Ok(stat) => Some(stat),
|
||||
Err(nix::Error::Sys(nix::errno::Errno::ENOENT)) => None,
|
||||
Err(nix::errno::Errno::ENOENT) => None,
|
||||
Err(err) => bail!("unable to stat '{}' - {}", ACL_CFG_FILENAME, err),
|
||||
};
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ pub fn cached_config() -> Result<Arc<SectionConfigData>, Error> {
|
|||
|
||||
let stat = match nix::sys::stat::stat(USER_CFG_FILENAME) {
|
||||
Ok(stat) => Some(stat),
|
||||
Err(nix::Error::Sys(nix::errno::Errno::ENOENT)) => None,
|
||||
Err(nix::errno::Errno::ENOENT) => None,
|
||||
Err(err) => bail!("unable to stat '{}' - {}", USER_CFG_FILENAME, err),
|
||||
};
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ hex = { version = "0.4.3", features = [ "serde" ] }
|
|||
lazy_static = "1.4"
|
||||
libc = "0.2"
|
||||
log = "0.4.17"
|
||||
nix = "0.19.1"
|
||||
nix = "0.24"
|
||||
openssl = "0.10"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
|
@ -32,7 +32,7 @@ proxmox-lang = "1.1"
|
|||
proxmox-schema = { version = "1.3.1", features = [ "api-macro" ] }
|
||||
proxmox-time = "1"
|
||||
proxmox-uuid = "1"
|
||||
proxmox-sys = "0.2"
|
||||
proxmox-sys = "0.3"
|
||||
|
||||
pbs-api-types = { path = "../pbs-api-types" }
|
||||
pbs-buildcfg = { path = "../pbs-buildcfg" }
|
||||
|
|
|
@ -147,7 +147,7 @@ impl BackupGroup {
|
|||
/* close else this leaks! */
|
||||
nix::unistd::close(rawfd)?;
|
||||
}
|
||||
Err(nix::Error::Sys(nix::errno::Errno::ENOENT)) => {
|
||||
Err(nix::errno::Errno::ENOENT) => {
|
||||
return Ok(());
|
||||
}
|
||||
Err(err) => {
|
||||
|
|
|
@ -221,7 +221,7 @@ impl ChunkStore {
|
|||
})?;
|
||||
|
||||
if let Err(err) = res {
|
||||
if !assert_exists && err.as_errno() == Some(nix::errno::Errno::ENOENT) {
|
||||
if !assert_exists && err == nix::errno::Errno::ENOENT {
|
||||
return Ok(false);
|
||||
}
|
||||
bail!("update atime failed for chunk/file {path:?} - {err}");
|
||||
|
@ -304,7 +304,7 @@ impl ChunkStore {
|
|||
// start reading:
|
||||
continue;
|
||||
}
|
||||
Err(ref err) if err.as_errno() == Some(nix::errno::Errno::ENOENT) => {
|
||||
Err(ref err) if err == &nix::errno::Errno::ENOENT => {
|
||||
// non-existing directories are okay, just keep going:
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -433,7 +433,7 @@ impl DataStore {
|
|||
ty_dir.push(ty.to_string());
|
||||
// best effort only, but we probably should log the error
|
||||
if let Err(err) = unlinkat(Some(base_fd), &ty_dir, UnlinkatFlags::RemoveDir) {
|
||||
if err.as_errno() != Some(nix::errno::Errno::ENOENT) {
|
||||
if err != nix::errno::Errno::ENOENT {
|
||||
log::error!("failed to remove backup type {ty} in {ns} - {err}");
|
||||
}
|
||||
}
|
||||
|
@ -483,10 +483,10 @@ impl DataStore {
|
|||
if !ns.is_root() {
|
||||
match unlinkat(Some(base_fd), &ns.path(), UnlinkatFlags::RemoveDir) {
|
||||
Ok(()) => log::debug!("removed namespace {ns}"),
|
||||
Err(nix::Error::Sys(nix::errno::Errno::ENOENT)) => {
|
||||
Err(nix::errno::Errno::ENOENT) => {
|
||||
log::debug!("namespace {ns} already removed")
|
||||
}
|
||||
Err(nix::Error::Sys(nix::errno::Errno::ENOTEMPTY)) if !delete_groups => {
|
||||
Err(nix::errno::Errno::ENOTEMPTY) if !delete_groups => {
|
||||
removed_all_requested = false;
|
||||
log::debug!("skip removal of non-empty namespace {ns}")
|
||||
}
|
||||
|
|
|
@ -196,7 +196,7 @@ impl Iterator for ListNamespaces {
|
|||
|
||||
let ns_dirfd = match proxmox_sys::fs::read_subdir(libc::AT_FDCWD, &base_path) {
|
||||
Ok(dirfd) => dirfd,
|
||||
Err(nix::Error::Sys(nix::errno::Errno::ENOENT)) => return None,
|
||||
Err(nix::errno::Errno::ENOENT) => return None,
|
||||
Err(err) => return Some(Err(err.into())),
|
||||
};
|
||||
// found a ns directory, descend into it to scan all it's namespaces
|
||||
|
|
|
@ -10,10 +10,10 @@ anyhow = "1.0"
|
|||
futures = "0.3"
|
||||
lazy_static = "1.4"
|
||||
libc = "0.2"
|
||||
nix = "0.19.1"
|
||||
nix = "0.24"
|
||||
regex = "1.5"
|
||||
tokio = { version = "1.6", features = [] }
|
||||
|
||||
proxmox-time = "1"
|
||||
proxmox-fuse = "0.1.1"
|
||||
proxmox-sys = "0.2"
|
||||
proxmox-sys = "0.3"
|
|
@ -330,7 +330,7 @@ fn unmap_from_backing(backing_file: &Path, loopdev: Option<&str>) -> Result<(),
|
|||
// send SIGINT to trigger cleanup and exit in target process
|
||||
match signal::kill(pid, Signal::SIGINT) {
|
||||
Ok(()) => {}
|
||||
Err(nix::Error::Sys(nix::errno::Errno::ESRCH)) => {
|
||||
Err(nix::errno::Errno::ESRCH) => {
|
||||
emerg_cleanup(loopdev, backing_file.to_owned());
|
||||
return Ok(());
|
||||
}
|
||||
|
@ -348,7 +348,7 @@ fn unmap_from_backing(backing_file: &Path, loopdev: Option<&str>) -> Result<(),
|
|||
}
|
||||
std::thread::sleep(std::time::Duration::from_millis(100));
|
||||
}
|
||||
Err(nix::Error::Sys(nix::errno::Errno::ESRCH)) => {
|
||||
Err(nix::errno::Errno::ESRCH) => {
|
||||
break;
|
||||
}
|
||||
Err(e) => return Err(e.into()),
|
||||
|
|
|
@ -12,7 +12,7 @@ anyhow = "1.0"
|
|||
thiserror = "1.0"
|
||||
endian_trait = { version = "0.6", features = ["arrays"] }
|
||||
hex = "0.4.3"
|
||||
nix = "0.19.1"
|
||||
nix = "0.24"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
bitflags = "1.2.1"
|
||||
|
@ -28,7 +28,7 @@ proxmox-uuid = "1"
|
|||
|
||||
# router::cli is only used by binaries, so maybe we should split them out
|
||||
proxmox-router = "1.2"
|
||||
proxmox-sys = "0.2"
|
||||
proxmox-sys = "0.3"
|
||||
|
||||
pbs-api-types = { path = "../pbs-api-types" }
|
||||
pbs-config = { path = "../pbs-config" }
|
||||
|
|
|
@ -442,7 +442,7 @@ impl<'a, F: AsRawFd> SgRaw<'a, F> {
|
|||
SCSI_PT_DO_TIMEOUT => return Err(format_err!("do_scsi_pt failed - timeout").into()),
|
||||
code if code < 0 => {
|
||||
let errno = unsafe { get_scsi_pt_os_err(ptvp.as_ptr()) };
|
||||
let err = nix::Error::from_errno(nix::errno::Errno::from_i32(errno));
|
||||
let err = nix::errno::Errno::from_i32(errno);
|
||||
return Err(format_err!("do_scsi_pt failed with err {}", err).into());
|
||||
}
|
||||
unknown => {
|
||||
|
@ -524,7 +524,7 @@ impl<'a, F: AsRawFd> SgRaw<'a, F> {
|
|||
}
|
||||
SCSI_PT_RESULT_OS_ERR => {
|
||||
let errno = unsafe { get_scsi_pt_os_err(ptvp.as_ptr()) };
|
||||
let err = nix::Error::from_errno(nix::errno::Errno::from_i32(errno));
|
||||
let err = nix::errno::Errno::from_i32(errno);
|
||||
return Err(format_err!("scsi command failed with err {}", err).into());
|
||||
}
|
||||
unknown => {
|
||||
|
|
|
@ -19,7 +19,7 @@ hex = "0.4.3"
|
|||
lazy_static = "1.4"
|
||||
libc = "0.2"
|
||||
log = "0.4.17"
|
||||
nix = "0.19.1"
|
||||
nix = "0.24"
|
||||
nom = "5.1"
|
||||
openssl = "0.10"
|
||||
percent-encoding = "2.1"
|
||||
|
@ -38,7 +38,7 @@ proxmox-borrow = "1"
|
|||
proxmox-io = { version = "1", features = [ "tokio" ] }
|
||||
proxmox-lang = { version = "1.1" }
|
||||
proxmox-time = { version = "1" }
|
||||
proxmox-sys = "0.2"
|
||||
proxmox-sys = "0.3"
|
||||
|
||||
pbs-buildcfg = { path = "../pbs-buildcfg" }
|
||||
pbs-api-types = { path = "../pbs-api-types" }
|
||||
|
|
|
@ -5,4 +5,5 @@ authors = ["Proxmox Support Team <support@proxmox.com>"]
|
|||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
nix = "0.19.1"
|
||||
anyhow = "1"
|
||||
nix = "0.24"
|
||||
|
|
|
@ -1,12 +1,29 @@
|
|||
use anyhow::{format_err, Error};
|
||||
|
||||
use std::fmt::Write;
|
||||
use std::fs;
|
||||
use std::net::ToSocketAddrs;
|
||||
use std::os::unix::prelude::OsStrExt;
|
||||
|
||||
use nix::sys::utsname::uname;
|
||||
|
||||
fn nodename() -> Result<String, Error> {
|
||||
let uname = uname().map_err(|err| format_err!("uname() failed - {err}"))?; // save on stack to avoid to_owned() allocation below
|
||||
std::str::from_utf8(uname.nodename().as_bytes())?
|
||||
.split('.')
|
||||
.next()
|
||||
.ok_or_else(|| format_err!("Failed to split FQDN to get hostname"))
|
||||
.map(|s| s.to_owned())
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let uname = uname(); // save on stack to avoid to_owned() allocation below
|
||||
let nodename = uname.nodename().split('.').next().unwrap();
|
||||
let nodename = match nodename() {
|
||||
Ok(value) => value,
|
||||
Err(err) => {
|
||||
eprintln!("Failed to retrieve hostname: {err}");
|
||||
"INVALID".to_string()
|
||||
}
|
||||
};
|
||||
|
||||
let addr = format!("{}:8007", nodename);
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ anyhow = "1.0"
|
|||
futures = "0.3"
|
||||
hyper = { version = "0.14", features = [ "full" ] }
|
||||
libc = "0.2"
|
||||
nix = "0.19.1"
|
||||
nix = "0.24"
|
||||
openssl = "0.10"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
|
@ -27,7 +27,7 @@ proxmox-io = "1.0.1"
|
|||
proxmox-router = { version = "1.2", features = [ "cli" ] }
|
||||
proxmox-schema = { version = "1.3.1", features = [ "api-macro" ] }
|
||||
proxmox-time = "1"
|
||||
proxmox-sys = { version = "0.2.1", features = [ "sortable-macro" ] }
|
||||
proxmox-sys = { version = "0.3", features = [ "sortable-macro" ] }
|
||||
|
||||
pbs-api-types = { path = "../pbs-api-types" }
|
||||
pbs-buildcfg = { path = "../pbs-buildcfg" }
|
||||
|
|
|
@ -9,7 +9,7 @@ anyhow = "1.0"
|
|||
base64 = "0.13"
|
||||
futures = "0.3"
|
||||
libc = "0.2"
|
||||
nix = "0.19.1"
|
||||
nix = "0.24"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
tokio = { version = "1.6", features = [ "io-std", "rt", "rt-multi-thread", "time" ] }
|
||||
|
@ -23,7 +23,7 @@ proxmox-router = { version = "1.2", features = [ "cli" ] }
|
|||
proxmox-schema = { version = "1.3.1", features = [ "api-macro" ] }
|
||||
proxmox-time = "1"
|
||||
proxmox-uuid = "1"
|
||||
proxmox-sys = "0.2"
|
||||
proxmox-sys = "0.3"
|
||||
|
||||
pbs-api-types = { path = "../pbs-api-types" }
|
||||
pbs-buildcfg = { path = "../pbs-buildcfg" }
|
||||
|
|
|
@ -19,7 +19,7 @@ hyper = { version = "0.14.5", features = [ "full" ] }
|
|||
lazy_static = "1.4"
|
||||
libc = "0.2"
|
||||
log = "0.4.17"
|
||||
nix = "0.19.1"
|
||||
nix = "0.24"
|
||||
once_cell = "1.3.1"
|
||||
percent-encoding = "2.1"
|
||||
regex = "1.5"
|
||||
|
@ -40,4 +40,4 @@ proxmox-http = { version = "0.6", features = [ "client" ] }
|
|||
proxmox-router = "1.2"
|
||||
proxmox-schema = { version = "1.3.1", features = [ "api-macro", "upid-api-impl" ] }
|
||||
proxmox-time = "1"
|
||||
proxmox-sys = "0.2"
|
||||
proxmox-sys = { version = "0.3", features = [ "logrotate" ] }
|
||||
|
|
|
@ -15,7 +15,7 @@ hyper = { version = "0.14", features = [ "full" ] }
|
|||
lazy_static = "1.4"
|
||||
libc = "0.2"
|
||||
log = "0.4.17"
|
||||
nix = "0.19.1"
|
||||
nix = "0.24"
|
||||
regex = "1.5"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
|
@ -31,7 +31,7 @@ proxmox-compression = "0.1.1"
|
|||
proxmox-router = { version = "1.2", features = [ "cli" ] }
|
||||
proxmox-schema = { version = "1.3.1", features = [ "api-macro" ] }
|
||||
proxmox-time = "1"
|
||||
proxmox-sys = { version = "0.2", features = [ "sortable-macro" ] }
|
||||
proxmox-sys = { version = "0.3", features = [ "sortable-macro" ] }
|
||||
|
||||
pbs-api-types = { path = "../pbs-api-types" }
|
||||
pbs-tools = { path = "../pbs-tools" }
|
||||
|
|
|
@ -171,7 +171,7 @@ fn get_vsock_fd() -> Result<RawFd, Error> {
|
|||
None,
|
||||
)?;
|
||||
let sock_addr = VsockAddr::new(libc::VMADDR_CID_ANY, DEFAULT_VSOCK_PORT as u32);
|
||||
bind(sock_fd, &SockAddr::Vsock(sock_addr))?;
|
||||
bind(sock_fd, &sock_addr)?;
|
||||
listen(sock_fd, MAX_PENDING)?;
|
||||
Ok(sock_fd)
|
||||
}
|
||||
|
|
|
@ -336,8 +336,8 @@ impl Filesystems {
|
|||
info!("mounting '{}' succeeded, fstype: '{}'", source, fs);
|
||||
return Ok(());
|
||||
}
|
||||
Err(nix::Error::Sys(nix::errno::Errno::EINVAL)) => {}
|
||||
Err(nix::Error::Sys(nix::errno::Errno::EBUSY)) => return Ok(()),
|
||||
Err(nix::errno::Errno::EINVAL) => {}
|
||||
Err(nix::errno::Errno::EBUSY) => return Ok(()),
|
||||
Err(err) => {
|
||||
warn!("mount error on '{}' ({}) - {}", source, fs, err);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ bitflags = "1.2.1"
|
|||
crossbeam-channel = "0.5"
|
||||
libc = "0.2"
|
||||
log = "0.4.17"
|
||||
nix = "0.19.1"
|
||||
nix = "0.24"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
serde_cbor = "0.11.1"
|
||||
|
@ -22,4 +22,4 @@ serde_cbor = "0.11.1"
|
|||
#proxmox = { version = "0.15.3" }
|
||||
proxmox-time = "1"
|
||||
proxmox-schema = { version = "1.3.1", features = [ "api-macro" ] }
|
||||
proxmox-sys = "0.2"
|
||||
proxmox-sys = "0.3"
|
|
@ -11,7 +11,7 @@ path = "src/main.rs"
|
|||
[dependencies]
|
||||
anyhow = "1.0"
|
||||
futures = "0.3"
|
||||
nix = "0.19.1"
|
||||
nix = "0.24"
|
||||
serde_json = "1.0"
|
||||
tokio = { version = "1.6", features = [ "rt", "rt-multi-thread" ] }
|
||||
|
||||
|
@ -20,7 +20,7 @@ pathpatterns = "0.1.2"
|
|||
proxmox-async = "0.4"
|
||||
proxmox-schema = { version = "1.3.1", features = [ "api-macro" ] }
|
||||
proxmox-router = "1.2"
|
||||
proxmox-sys = "0.2"
|
||||
proxmox-sys = "0.3"
|
||||
pxar = { version = "0.10.1", features = [ "tokio-io" ] }
|
||||
|
||||
pbs-client = { path = "../pbs-client" }
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use anyhow::{bail, format_err, Error};
|
||||
use serde_json::{json, Value};
|
||||
use std::collections::HashMap;
|
||||
use std::os::unix::prelude::OsStrExt;
|
||||
|
||||
use proxmox_router::{
|
||||
list_subdirs_api_method, Permission, Router, RpcEnvironment, RpcEnvironmentType, SubdirMap,
|
||||
|
@ -360,7 +361,7 @@ pub fn get_versions() -> Result<Vec<APTUpdateInfo>, Error> {
|
|||
|
||||
let running_kernel = format!(
|
||||
"running kernel: {}",
|
||||
nix::sys::utsname::uname().release().to_owned()
|
||||
std::str::from_utf8(nix::sys::utsname::uname()?.release().as_bytes())?.to_owned()
|
||||
);
|
||||
if let Some(proxmox_backup) = pbs_packages
|
||||
.iter()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use std::path::Path;
|
||||
use std::process::Command;
|
||||
use std::{os::unix::prelude::OsStrExt, path::Path};
|
||||
|
||||
use anyhow::{bail, format_err, Error};
|
||||
use serde_json::Value;
|
||||
|
@ -69,12 +69,12 @@ fn get_status(
|
|||
let cpuinfo = procfs::read_cpuinfo()?;
|
||||
let cpuinfo = cpuinfo.into();
|
||||
|
||||
let uname = nix::sys::utsname::uname();
|
||||
let uname = nix::sys::utsname::uname()?;
|
||||
let kversion = format!(
|
||||
"{} {} {}",
|
||||
uname.sysname(),
|
||||
uname.release(),
|
||||
uname.version()
|
||||
std::str::from_utf8(uname.sysname().as_bytes())?,
|
||||
std::str::from_utf8(uname.release().as_bytes())?,
|
||||
std::str::from_utf8(uname.version().as_bytes())?
|
||||
);
|
||||
|
||||
Ok(NodeStatus {
|
||||
|
|
|
@ -60,7 +60,7 @@ pub fn create_configdir() -> Result<(), Error> {
|
|||
|
||||
match nix::unistd::mkdir(cfgdir, Mode::from_bits_truncate(0o700)) {
|
||||
Ok(()) => {}
|
||||
Err(nix::Error::Sys(nix::errno::Errno::EEXIST)) => {
|
||||
Err(nix::errno::Errno::EEXIST) => {
|
||||
check_configdir_permissions()?;
|
||||
return Ok(());
|
||||
}
|
||||
|
|
|
@ -382,7 +382,7 @@ pub fn update_apt_auth(key: Option<String>, password: Option<String>) -> Result<
|
|||
}
|
||||
_ => match nix::unistd::unlink(auth_conf) {
|
||||
Ok(()) => Ok(()),
|
||||
Err(nix::Error::Sys(nix::errno::Errno::ENOENT)) => Ok(()), // ignore not existing
|
||||
Err(nix::errno::Errno::ENOENT) => Ok(()), // ignore not existing
|
||||
Err(err) => Err(err),
|
||||
}
|
||||
.map_err(|e| format_err!("Error clearing apt auth config - {}", e))?,
|
||||
|
|
Loading…
Reference in New Issue