From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id E11061FF165 for ; Thu, 6 Nov 2025 14:43:22 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 0D5B6175A6; Thu, 6 Nov 2025 14:44:02 +0100 (CET) From: Lukas Wagner To: pdm-devel@lists.proxmox.com Date: Thu, 6 Nov 2025 14:43:44 +0100 Message-ID: <20251106134353.263598-3-l.wagner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251106134353.263598-1-l.wagner@proxmox.com> References: <20251106134353.263598-1-l.wagner@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1762436618217 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.028 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [lib.rs, views.rs] Subject: [pdm-devel] [PATCH datacenter-manager v3 02/11] pdm-config: views: add support for views X-BeenThere: pdm-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Datacenter Manager development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pdm-devel-bounces@lists.proxmox.com Sender: "pdm-devel" This allows to read ViewConfig entries from a new config file at /etc/proxmox-datacenter-manager/views.cfg Signed-off-by: Lukas Wagner --- Notes: Changes since v2: - Change config path to 'views.cfg' instead of 'views/filters.cfg' lib/pdm-config/src/lib.rs | 2 +- lib/pdm-config/src/views.rs | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 lib/pdm-config/src/views.rs diff --git a/lib/pdm-config/src/lib.rs b/lib/pdm-config/src/lib.rs index ac398cab..4c490541 100644 --- a/lib/pdm-config/src/lib.rs +++ b/lib/pdm-config/src/lib.rs @@ -1,6 +1,5 @@ use anyhow::{format_err, Error}; use nix::unistd::{Gid, Group, Uid, User}; - pub use pdm_buildcfg::{BACKUP_GROUP_NAME, BACKUP_USER_NAME}; pub mod certificate_config; @@ -8,6 +7,7 @@ pub mod domains; pub mod node; pub mod remotes; pub mod setup; +pub mod views; mod config_version_cache; pub use config_version_cache::ConfigVersionCache; diff --git a/lib/pdm-config/src/views.rs b/lib/pdm-config/src/views.rs new file mode 100644 index 00000000..59c02a66 --- /dev/null +++ b/lib/pdm-config/src/views.rs @@ -0,0 +1,17 @@ +use anyhow::Error; + +use proxmox_section_config::typed::{ApiSectionDataEntry, SectionConfigData}; + +use pdm_api_types::views::ViewConfigEntry; + +use pdm_buildcfg::configdir; + +const VIEW_CFG_FILENAME: &str = configdir!("/views.cfg"); + +/// Get the `views.cfg` config file contents. +pub fn config() -> Result, Error> { + let content = + proxmox_sys::fs::file_read_optional_string(VIEW_CFG_FILENAME)?.unwrap_or_default(); + + ViewConfigEntry::parse_section_config(VIEW_CFG_FILENAME, &content) +} -- 2.47.3 _______________________________________________ pdm-devel mailing list pdm-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel