Unverified Commit 30247c00 authored by Vasili Novikov's avatar Vasili Novikov
Browse files

Merge branch 'jlowry/pod-fix-compilation-error' into dev

parents 8b472c28 97f6779b
Showing with 11 additions and 34 deletions
+11 -34
......@@ -475,29 +475,6 @@ mod tests {
.contains(expected_error));
}
{
// ignore already defined Schemas
let json = json!({
"type": "ItemPropertySchema",
"itemType": "Person",
"propertyName": "dateCreated",
"valueType": "DateTime",
});
let create_item: CreateItem = serde_json::from_value(json).unwrap();
assert_eq!(
internal_api::create_item_tx(
&tx,
&minimal_schema,
create_item,
"",
&cli,
&database_key
)
.unwrap(),
"___ignored___"
);
}
let bad_empty_schema = Schema {
property_types: HashMap::new(),
};
......
......@@ -30,28 +30,28 @@ pub fn run_plugin_container(
"Trying to run plugin container for target_item_id {}",
target_item_id
);
let item = internal_api::get_item_tx(tx, schema, target_item_id)?;
let item = item.into_iter().next().ok_or_else(|| Error {
let target_item = internal_api::get_item_tx(tx, schema, target_item_id)?;
let target_item = target_item.into_iter().next().ok_or_else(|| Error {
code: StatusCode::BAD_REQUEST,
msg: format!(
"Failed to find target item {} to run a plugin against",
target_item_id
),
})?;
let item = serde_json::to_string(&item)?;
let target_item_json = serde_json::to_string(&target_item)?;
let auth = database_key.create_plugin_auth()?;
let auth = serde_json::to_string(&auth)?;
let container_id = format!(
"{}-{}-{}",
pod_owner.chars().take(10).collect(),
container_image.chars().take(15).collect(),
pod_owner.chars().take(10).collect::<String>(),
container_image.chars().take(15).collect::<String>(),
new_random_item_id()
);
if cli_options.use_kubernetes {
run_kubernetes_container(
&container_image,
container_id,
&target_item_id,
&target_item_json,
pod_owner,
&auth,
triggered_by_item_id,
......@@ -61,7 +61,7 @@ pub fn run_plugin_container(
run_docker_container(
&container_image,
container_id,
&target_item_id,
&target_item_json,
pod_owner,
&auth,
triggered_by_item_id,
......@@ -84,7 +84,7 @@ pub fn run_plugin_container(
fn run_docker_container(
container_image: &str,
container_id: String,
target_item: &str,
target_item_json: &str,
pod_owner: &str,
pod_auth: &str,
triggered_by_item_id: &str,
......@@ -101,7 +101,7 @@ fn run_docker_container(
"--env=POD_FULL_ADDRESS={}",
callback_address(cli_options)
));
args.push(format!("--env=POD_TARGET_ITEM={}", target_item));
args.push(format!("--env=POD_TARGET_ITEM={}", target_item_json));
args.push(format!("--env=POD_PLUGINRUN_ID={}", triggered_by_item_id));
args.push(format!("--env=POD_OWNER={}", pod_owner));
args.push(format!("--env=POD_AUTH_JSON={}", pod_auth));
......@@ -122,7 +122,7 @@ fn run_docker_container(
fn run_kubernetes_container(
container_image: &str,
container_id: String,
target_item: &str,
target_item_json: &str,
pod_owner: &str,
pod_auth: &str,
triggered_by_item_id: &str,
......@@ -136,7 +136,7 @@ fn run_kubernetes_container(
"--env=POD_FULL_ADDRESS={}",
callback_address(cli_options)
));
args.push(format!("--env=POD_TARGET_ITEM={}", target_item));
args.push(format!("--env=POD_TARGET_ITEM={}", target_item_json));
args.push(format!("--env=POD_PLUGINRUN_ID={}", triggered_by_item_id));
args.push(format!("--env=POD_OWNER={}", pod_owner));
args.push(format!("--env=POD_AUTH_JSON={}", pod_auth));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment