mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-06 02:00:46 +00:00
fix breakage due to s3 client upgrade (YOLO) + lint fixes
This commit is contained in:
1 parent
1900a31541
commit
d5c86d1345
4 files changed
+10
-10
No files matched your search
@@ -30,12 +30,14 @@ pub fn list_pods() -> AnyhowResult<Vec<PodInfo>> {
|
||||
parse_pod_status_output(&stdout)
|
||||
}
|
||||
|
||||
const LIST_POD_REGEX : Lazy<Regex> = Lazy::new(|| {
|
||||
Regex::new(r"(\S+)\s+(\S+)\s+(\S+)\s+((\d+\s\(\S+ ago\))|(\S+))\s+(\S+).*")
|
||||
.expect("regex should parse")
|
||||
});
|
||||
|
||||
fn parse_pod_status_output(stdout: &str) -> AnyhowResult<Vec<PodInfo>> {
|
||||
// Parse `kubectl get pods` lines
|
||||
const LIST_POD_REGEX : Lazy<Regex> = Lazy::new(|| {
|
||||
Regex::new(r"(\S+)\s+(\S+)\s+(\S+)\s+((\d+\s\(\S+ ago\))|(\S+))\s+(\S+).*")
|
||||
.expect("regex should parse")
|
||||
});
|
||||
let regex = LIST_POD_REGEX; // NB: To pass lint on const interior mutability (???)
|
||||
|
||||
let lines = stdout.split("\n")
|
||||
.into_iter()
|
||||
@@ -44,7 +46,7 @@ fn parse_pod_status_output(stdout: &str) -> AnyhowResult<Vec<PodInfo>> {
|
||||
|
||||
Ok(lines.iter()
|
||||
.filter_map(|line| {
|
||||
LIST_POD_REGEX.captures(line)
|
||||
regex.captures(line)
|
||||
})
|
||||
.skip(1) // NB: We skip the first line as that's the header.
|
||||
.map(|captures| {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
use std::ops::Index;
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
|
||||
@@ -7,7 +6,6 @@ use log::info;
|
||||
use config::shared_constants::DEFAULT_RUST_LOG;
|
||||
use errors::AnyhowResult;
|
||||
|
||||
use crate::delete_pods::delete_pods;
|
||||
use crate::delete_pods_threaded::delete_pods_threaded;
|
||||
use crate::list_pods::list_pods;
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ impl PodStore {
|
||||
pub fn grab_batch(&self, batch_size: usize) -> AnyhowResult<HashSet<String>> {
|
||||
match self.pod_names.read() {
|
||||
Err(err) => {
|
||||
return Err(anyhow!("lock error: {:?}", err));
|
||||
Err(anyhow!("lock error: {:?}", err))
|
||||
}
|
||||
Ok(read) => {
|
||||
let mut batch : HashSet<String> = HashSet::with_capacity(batch_size);
|
||||
@@ -48,7 +48,7 @@ impl PodStore {
|
||||
pub fn expunge_pods(&self, pod_names: &Vec<String>) -> AnyhowResult<()> {
|
||||
match self.pod_names.write() {
|
||||
Err(err) => {
|
||||
return Err(anyhow!("lock error: {:?}", err));
|
||||
Err(anyhow!("lock error: {:?}", err))
|
||||
}
|
||||
Ok(mut write) => {
|
||||
for pod_name in pod_names {
|
||||
|
||||
@@ -201,7 +201,7 @@ impl BucketClient {
|
||||
|
||||
let mut output_file = tokio::fs::File::create(filesystem_path).await?;
|
||||
|
||||
let status_code = self.bucket.get_object_stream(&object_path_str, &mut output_file).await?;
|
||||
let status_code = self.bucket.get_object_to_writer(&object_path_str, &mut output_file).await?;
|
||||
|
||||
match status_code {
|
||||
404 => bail!("File not found in bucket: {}", &object_path_str),
|
||||
|
||||
Reference in new issue
Block a user