Hello,
now I have a running extension. As you can see down below I am trying to
run an external python file. I even tried to write to a file. Both times I
got the same error. I tried to change the permissions of the files test.py
and actionlog.txt using chmod +x. It didn't help. Do I need to do it
elsewhere? Or is there another way how to run external scripts? My goal is
to run a terminal command after a review request is shipped and submitted.
from reviewboard.extensions.base import Extension
import logging
import os
from reviewboard.extensions.hooks import ReviewRequestApprovalHook
from reviewboard.extensions.hooks import SignalHook
from reviewboard.reviews.signals import review_request_closed
from reviewboard.reviews.models import ReviewRequest
from datetime import datetime
class SampleApprovalHook(ReviewRequestApprovalHook):
<------>now = datetime.now()
<------>current_time = now.strftime(" %d/%m/%Y : %H:%M:%S ")
<------>def is_approved(self, review_request, prev_approved, prev_failure):
<------><------>if review_request.shipit_count > 0:
<------><------><------>logging.critical("TRUE Je tam SHIPIT %s",
review_request.shipit_count)
<------><------><------>logging.critical("SHIP IT JEAH %s, Pocet SHIPIT:
%s", review_request.display_id, review_request.shipit_count)
<-----><------><------>os.system("python /home/pgrenar/Plocha/test.py")
<------><------><------>f = open("/home/pgrenar/Plocha/actionlog.txt", "a")
<------><------><------>f.write("Request created =" + current_time +
"___\n")
<------><------><------>f.close()
<------><------><------>return True
<------><------>else:
<------><------><------>logging.critical("FALSE Je tam SHIPIT %s",
review_request.shipit_count)
<------><------><------>return False
class SampleSignalExtension(Extension):
<------>def initialize(self):
<------><------>SignalHook(self, review_request_closed, self.on_closed)
<------><------>logging.critical("Initialize")
<------>def shutdown(self):
<------><------>logging.critical("Shutdown")
<------>def on_closed(self, user, review_request, type, **kwargs):
<------><------>if type == ReviewRequest.SUBMITTED:
<------><------><------>approvalHook = SampleApprovalHook(self)
--
Supercharge your Review Board with Power Pack:
https://www.reviewboard.org/powerpack/
Want us to host Review Board for you? Check out RBCommons:
https://rbcommons.com/
Happy user? Let us know! https://www.reviewboard.org/users/
---
You received this message because you are subscribed to the Google Groups
"Review Board Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/reviewboard/083ec591-1d9e-4d5d-a40b-93863b796e2b%40googlegroups.com.