Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 99d7b5f74e | |||
| 6327adeabf | |||
| b289e9324c | |||
| a80c2ca1e1 | |||
| dd206eb272 |
@@ -1,3 +1,4 @@
|
||||
/target
|
||||
build.sh
|
||||
pythontest.py
|
||||
changelog.md
|
||||
Generated
+1
-1
@@ -26,7 +26,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "airlock_libs"
|
||||
version = "4.0.0"
|
||||
version = "4.0.3"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"indicatif",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "airlock_libs"
|
||||
version = "4.0.0"
|
||||
version = "4.0.3"
|
||||
edition = "2024"
|
||||
|
||||
[lib]
|
||||
|
||||
@@ -4,7 +4,7 @@ build-backend = "maturin"
|
||||
|
||||
[project]
|
||||
name = "airlock_libs"
|
||||
version = "4.0.0"
|
||||
version = "4.0.3"
|
||||
description = "Airlock Digital API Wrapper"
|
||||
readme = "README.md"
|
||||
license = { text = "AGPL-3.0-only" }
|
||||
|
||||
@@ -96,7 +96,13 @@ pub fn pull_policy_exec_histories(
|
||||
exec_types: String,
|
||||
days: i64,
|
||||
) -> Py<PyString> {
|
||||
let rt = tokio::runtime::Runtime::new().unwrap();
|
||||
let rt = match tokio::runtime::Runtime::new() {
|
||||
Ok(rt) => rt,
|
||||
Err(e) => {
|
||||
println!("Failed to build Tokio Runtime: {:?}", e);
|
||||
std::process::abort();
|
||||
}
|
||||
};
|
||||
rt.block_on(async {
|
||||
let _ = init_tracer();
|
||||
});
|
||||
@@ -135,7 +141,13 @@ pub fn pull_policy_exec_histories(
|
||||
},
|
||||
};
|
||||
let data_write = serde_json::to_string_pretty(&data).expect("Failed to serialize");
|
||||
fs::write(writeable_filepath.clone(), data_write).unwrap();
|
||||
match fs::write(writeable_filepath.clone(), data_write) {
|
||||
Ok(_) => {}
|
||||
Err(e) => {
|
||||
println!("Failed to write to: {:?}: {}", &writeable_filepath, e);
|
||||
std::process::abort();
|
||||
}
|
||||
}
|
||||
let mut checkpoint_number: String = skipback(days).to_string();
|
||||
let multi_progress = MultiProgress::new();
|
||||
multi_progress.set_draw_target(ProgressDrawTarget::stdout());
|
||||
@@ -185,7 +197,8 @@ pub fn pull_policy_exec_histories(
|
||||
};
|
||||
tracer.in_span("Airlock Data Retreival", |cx| {
|
||||
let span = cx.span();
|
||||
span.set_attribute(Key::new("Days").string(days.to_string().to_string()));
|
||||
span.set_attribute(Key::new("Days").string(days.to_string()));
|
||||
span.set_attribute(KeyValue::new("Policy Name", policy_names.clone()));
|
||||
loop {
|
||||
match f.seek(SeekFrom::Start(0)) {
|
||||
Ok(_) => {}
|
||||
@@ -273,7 +286,12 @@ pub fn pull_policy_exec_histories(
|
||||
},
|
||||
};
|
||||
let data_write = serde_json::to_string_pretty(&final_response).unwrap();
|
||||
fs::write(&writeable_filepath, data_write).unwrap();
|
||||
match fs::write(&writeable_filepath, data_write) {
|
||||
Ok(_) => {}
|
||||
Err(e) => {
|
||||
println!("Failed to write to: {:?}: {}", &writeable_filepath, e);
|
||||
}
|
||||
}
|
||||
if let Some(last_item) = &final_response.response.exechistories.last()
|
||||
&& let Ok(last_date) = NaiveDate::parse_from_str(
|
||||
&last_item.datetime.replace(" +0000 UTC", ""),
|
||||
@@ -288,7 +306,13 @@ pub fn pull_policy_exec_histories(
|
||||
}
|
||||
});
|
||||
progress_bar.finish_with_message("All Checkpoints Complete");
|
||||
let return_data = fs::read_to_string(&writeable_filepath).unwrap();
|
||||
let return_data = match fs::read_to_string(&writeable_filepath) {
|
||||
Ok(return_data) => return_data,
|
||||
Err(e) => {
|
||||
println!("Failed to read data from: {:?}: {}", &writeable_filepath, e);
|
||||
std::process::abort();
|
||||
}
|
||||
};
|
||||
shutdown_tracer_provider();
|
||||
PyString::new(py, &return_data).into()
|
||||
}
|
||||
|
||||
+1
-1
@@ -11,4 +11,4 @@ urllib3==2.5.0
|
||||
pyperclip==1.11.0
|
||||
|
||||
--extra-index-url https://git.racooncity.org/api/packages/brotoskyj/pypi/simple/
|
||||
airlock_libs==4.0.0
|
||||
airlock_libs==4.0.3
|
||||
Reference in New Issue
Block a user