Skip to content

Commit

Permalink
Updated abstract to include plugin credential (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
shreypandey authored Aug 28, 2024
1 parent 687bfc9 commit 4c4106a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
24 changes: 14 additions & 10 deletions jb-manager-bot/jb_manager_bot/abstract_fsm.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,20 +599,24 @@ def _on_enter_plugin(self, plugin, input_variables, output_variables, message=No
)
)

plugin_input = {
key: (
getattr(self.variables, value)
if hasattr(self.variables, value)
else value
)
for key, value in input_variables.items()
}
plugin_output = plugin(**plugin_input)
plugin_input = {}
for key, value in input_variables.items():
if hasattr(self.variables, value):
plugin_input[key] = getattr(self.variables, value)
elif value in self.credentials:
plugin_input[key] = self.credentials[value]
else:
plugin_input[key] = value
if (
run_plugin_output := self.run_plugin(plugin, **plugin_input)
) == self.RUN_TOKEN:
return
plugin_status, plugin_output = run_plugin_output

for key, value in output_variables.items():
setattr(self.variables, value, plugin_output[key])

self.temp_variables["error_code"] = plugin_output["error_code"]
self.temp_variables["error_code"] = plugin_status

self.status = Status.MOVE_FORWARD

Expand Down
2 changes: 1 addition & 1 deletion jb-manager-bot/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "jb-manager-bot"
version = "0.2.2"
version = "0.2.3"
description = "Bot for JugalBandi Manager"
authors = ["Shrey Pandey <[email protected]>", "Sameer Segal <[email protected]>", "Atharv Kirtikar <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit 4c4106a

Please sign in to comment.