Hi Petr,

My first guess would be that Apache isn't able to read your home directory,
or that you're running on an OS with SELinux enabled, which would limit the
directories that Apache is allowed to even look at.

You'd be better off keeping any data files or scripts within your Review
Board site directory, probably under the data/ directory. It should have
permission to read/write there.

Christian

On Wed, Apr 15, 2020 at 6:40 AM Petr Grenar <grenar.p...@gmail.com> wrote:

> 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 reviewboard+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/reviewboard/083ec591-1d9e-4d5d-a40b-93863b796e2b%40googlegroups.com
> <https://groups.google.com/d/msgid/reviewboard/083ec591-1d9e-4d5d-a40b-93863b796e2b%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Christian Hammond
President/CEO of Beanbag <https://www.beanbaginc.com/>
Makers of Review Board <https://www.reviewboard.org/>

-- 
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 reviewboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/reviewboard/CAE7Vndk%2BSYmT16vL7UzDwwhL698-D_RbQvxV%2BbXm7-gyemr3GA%40mail.gmail.com.

Reply via email to