Skip to content

Commit

Permalink
agent: enable post-sync actions for ManagedToken::add
Browse files Browse the repository at this point in the history
This commit changes agent's behavior to process post-sync actions and
restarts the webserver if necessary.

Signed-off-by: Erdem Meydanli <meydanli@amazon.com>
  • Loading branch information
meerd committed Aug 7, 2024
1 parent 678113e commit f2b1c98
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/vtok_agent/src/agent/mngtok.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,21 +343,21 @@ impl ManagedToken {
Ok(())
}

fn add(&mut self) -> Result<(), Error> {
fn add(&mut self) -> Result<Option<PostSyncAction>, Error> {
self.enclave
.add_token(self.to_schema_token()?)
.map_err(Error::EnclaveError)?
.map_err(Error::AddTokenError)?;
self.satisfy_target(true).or_else(|e| {
return self.satisfy_target(true).or_else(|e| {
error!(
"Unable to satisfy target for token {}: {:?}",
self.label.as_str(),
e
);
Ok(None)
})?;
});

Ok(())
Ok(None)
}

pub fn sync(&mut self) -> Result<Option<PostSyncAction>, Error> {
Expand All @@ -381,7 +381,7 @@ impl ManagedToken {
}
(false, _) => {
debug!("Adding token: {}.", self.label.as_str());
self.add()?;
return self.add();
}
}

Expand Down

0 comments on commit f2b1c98

Please sign in to comment.