From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 3C740AE4C for ; Wed, 28 Jun 2023 12:48:38 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 1EA7C3E008 for ; Wed, 28 Jun 2023 12:48:38 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Wed, 28 Jun 2023 12:48:37 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 5ADB740BC8 for ; Wed, 28 Jun 2023 12:48:37 +0200 (CEST) Message-ID: <58573646-cfe6-5294-fde9-a4154b118a10@proxmox.com> Date: Wed, 28 Jun 2023 12:48:36 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Content-Language: en-US To: Proxmox Backup Server development discussion , Christian Ebner References: <20230628094225.53204-1-c.ebner@proxmox.com> From: Fiona Ebner In-Reply-To: <20230628094225.53204-1-c.ebner@proxmox.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.006 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 NICE_REPLY_A -0.103 Looks like a legit reply (A) SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - Subject: Re: [pbs-devel] [PATCH v2 backup stable-2] pbs2to3: add upgrade checker binary X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jun 2023 10:48:38 -0000 Am 28.06.23 um 11:42 schrieb Christian Ebner: > + > + fn check_repo_file( > + &mut self, > + repo_file: APTRepositoryFile, > + ) -> Result<(bool, Vec<(String, String)>), Error> { > + let mut strange_suite = false; > + let mut found_suite: Option<(String, String)> = None; > + let mut mismatches = Vec::new(); As already talked off-list, currently only detects mismatches within a file. > + fn get_systemd_unit_state( > + &mut self, > + unit: &str, > + ) -> Result<(SystemdUnitState, SystemdUnitState), Error> { > + let mut command = std::process::Command::new("systemctl"); > + command.arg("is-enabled"); > + command.arg(unit); > + let output = command > + .output() > + .map_err(|err| format_err!("failed to execute {:?} - {}", command, err))?; > + > + let is_enabled_state = match output.stdout.as_slice() { Nit: I'd prefer enabled_state because it's not a boolean > + b"enabled\n" => SystemdUnitState::Enabled, > + b"disabled\n" => SystemdUnitState::Disabled, > + _ => SystemdUnitState::Unknown, > + }; > + > + let mut command = std::process::Command::new("systemctl"); > + command.arg("is-active"); > + command.arg(unit); > + let output = command > + .output() > + .map_err(|err| format_err!("failed to execute {:?} - {}", command, err))?; > + > + let is_active_state = match output.stdout.as_slice() { Same > + b"active\n" => SystemdUnitState::Active, > + b"inactive\n" => SystemdUnitState::Inactive, > + b"failed\n" => SystemdUnitState::Failed, > + _ => SystemdUnitState::Unknown, > + }; > + Ok((is_enabled_state, is_active_state)) > + } > + > + fn check_pbs_services(&mut self) -> Result<(), Error> { > + self.output.log_info("Checking pbs daemon services..")?; s/pbs/PBS/ > + > + for service in ["proxmox-backup.service", "proxmox-backup-proxy.service"] { > + match self.get_systemd_unit_state(service)? { > + (_, SystemdUnitState::Active) => { > + self.output.log_pass( > + format!("systemd unit '{}' is in state 'active'", service).as_str(), > + )?; > + } > + (_, SystemdUnitState::Inactive) => { > + self.output.log_fail( > + format!( > + "systemd unit '{}' is in state 'inactive'\ > + \n Please check the service for errors and start it.", > + service, > + ) > + .as_str(), > + )?; > + } > + (_, SystemdUnitState::Failed) => { > + self.output.log_fail( > + format!( > + "systemd unit '{}' is in state 'failed'\ > + \n Please check the service for errors and start it.", > + service, > + ) > + .as_str(), > + )?; > + } > + (_, _) => { > + self.output.log_fail( > + format!( > + "systemd unit '{}' is not in state 'active'\ > + \n Please check the service for errors and start it.", > + service, > + ) > + .as_str(), > + )?; > + } > + } The enabled state is ignored? You just look at the active state. > + } > + Ok(()) > + } > + Other than that, didn't see anything obviously wrong :)