Skip to content

Commit

Permalink
Add forced variables to role config
Browse files Browse the repository at this point in the history
  • Loading branch information
tailhook committed Jul 6, 2018
1 parent fb764c2 commit fbe4522
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion example-configs/wasm-with-query/src/bin/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ pub extern "C" fn render_roles(ptr: *const u8, len: usize) -> *mut c_void {

fn _render_roles(_input: Value) -> Result<RolesResult, String> {
return Ok(RolesResult {
to_render: vec![("imaginary_role".to_string(), json!({}))]
to_render: vec![("imaginary_role".to_string(),
json!({"template": "non-existent"}))]
.into_iter().collect(),
all_roles: vec!["imaginary_role".to_string()].into_iter().collect(),
})
Expand Down
9 changes: 8 additions & 1 deletion src/daemon/apply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,15 @@ fn apply_schedule(hash: &String, is_new: bool,
}).map_err(|e| error!("Can't create changes log: {}", e)).ok();
}

let ref id = apply_task.id;
let string_schedule = format!("{}", apply_task.schedule.data);
for (role_name, vars) in apply_task.roles {
for (role_name, mut vars) in apply_task.roles {
vars.as_object_mut().map(|obj| {
obj.insert("deployment_id".into(), id.clone().into());
obj.insert("role".into(), role_name.clone().into());
obj.insert("verwalter_version".into(),
concat!("v", env!("CARGO_PKG_VERSION")).into());
});
let mut rlog = match dlog.role(&role_name, true) {
Ok(l) => l,
Err(e) => {
Expand Down

0 comments on commit fbe4522

Please sign in to comment.