Reputation: 2678
As a newbie to juju
framework, I'm invistigating simple machine
deployment with the aim of executing simple action
on it.
So, I've created a charm
bundle, built it and deployed it successfully using juju
. The bundle contains an action
called "touch" that takes a string (i.e.: filename) as an input and create a file with that name on the machine.
After the machine becomes "active" and when I list actions in the deployed machine using:
juju actions charmLayer
I get my action
listed alongside its description.
Now, when executing the actions "touch" using:
juju run-action charmLayer/0 touch filename="/home/ubuntu/manual.txt"
I get the following message:
Action queued with id: d6b39965-9a2c-41c6-8db7-b4060e587033
Then, when I check the action-status:
juju show-action-status d6b39965-9a2c-41c6-8db7-b4060e587033
I get the following:
actions:
action: touch
completed at: "2019-05-03 11:56:51"
id: d6b39965-9a2c-41c6-8db7-b4060e587033
status: failed
unit:
charmLayer/0
Then when I check the action-output:
juju show-action-output d6b39965-9a2c-41c6-8db7-b4060e587033
I get the following:
message: exit status 1
status: failed
timing:
completed: 2019-05-03 11:56:51 +0000 UTC
enqueued: 2019-05-03 11:56:48 +0000 UTC
started: 2019-05-03 11:56:51 +0000 UTC
when checking logs using :
juju debug-log
I see the following output:
unit-charmLayer-0: 13:23:14 DEBUG unit.charmLayer/0.touch Traceback (most recent call last):
unit-charmLayer-0: 13:23:14 DEBUG unit.charmLayer/0.touch File "/var/lib/juju/agents/unit-charmLayer-0/charm/actions/touch", line 6, in
unit-charmLayer-0: 13:23:14 DEBUG unit.charmLayer/0.touch from charms.reactive import main, set_flag
unit-charmLayer-0: 13:23:14 DEBUG unit.charmLayer/0.touch ImportError: No module named 'charms.reactive'
My question why am I getting this ImportError
for the charms.reactive
?
Upvotes: 1
Views: 401
Reputation: 173
Can you post your code? We might be able to help if we can see how you've composed your charm. (this should be a comment, not an answer. I don't have the rep).
In answer, are you importing charms.reactive? If you're writing a reactive charm it should have been included for you already if you did charm init
. Otherwise you might need to add import charms.reactive
at the top of your Python script.
Upvotes: 0