Jump to content

Error with before-checkin trigger


manish

Recommended Posts

Hello,

 

I have been successfully using a server-side after-checkin trigger and was trying to implement a server-side before-checkin trigger and am getting the following error on the client:

 

"Error trying to run trigger before-checkin commit-comment-check

ApplicationName="/opt/plasticscm_triggers/before_commit_comment_check.py", CommandLine="", CurrentDirectory='/opt/plasticscm_triggers", Native error= Access denied."

 

This is my current trigger setup (the first two successfully run, and are in the same location as the last one that fails)

cm ltr

     1 slack unitydevs python @TRIGGERS_PATH/after_commit_slack_unitydevs_notif.py manish     after-checkin rep:unityclient,*
     2 slack unitydevs python @TRIGGERS_PATH/after_commit_slack_unitydevs_notif.py manish     after-checkin rep:newterra,*
     1 commit-comment-check @TRIGGERS_PATH/before_commit_comment_check.py manish     before-checkin rep:testrepo,*

 

They have the same permissions

ls -l

-rw-r--r--. 1 root root 625 Sep 29 15:47 after_commit_slack_unitydevs_notif.py
-rw-r--r--. 1 root root 171 Feb 25 11:58 before_commit_comment_check.py

 

This is the content of the "before_commit_comment_check.py" file:

#! /usr/bin/python
import sys
import os

message = os.environ['PLASTIC_COMMENT']

if len(message) >= 10:
   sys.exit(0)
else:
  sys.exit(1)

 

What am I doing wrong? Is the client machine looking for the trigger on itself? I wouldn't image so since the client-side before check in trigger is a completely different type name.

 

It's more confusing since the after-checkin trigger has always worked and continues to work...
 

Link to comment
Share on other sites

  • 5 months later...

HI Manish,

 

I don't understand why it's failing, are you available for an online connection in order to review the issue? I would like to test a couple of things with you.

 

Best,

Manu.

 

Hey manu, I figured it out. I forgot the "python " prefix before the script file name for the cm maketrigger --file argument.

Now it works!

 

However, I am now trying something new and i cannot get it working. I am trying to access the standard input passed to the before-checkin trigger and i cannot get it to come out of an infinite loop. It is as if plastic is not sending it an EOF, which is causing the standard input read/readline functions to never stop. I have tried this both in Python and Ruby with the same errors.

 

We are using the latest to date version 5.4.16.771 on CentOS Linux release 7.2.1511

 

in python, doing a sys.stdin.readlines() i would expect to get me all of them at once in an array but it hangs, assuming because it doesn't know that the input is finished.

 

If i hardcode a message in the sys.stdin.write (python) or STDOUT.print (ruby) and then do exit(1), i can get that back to the clients.

 

To test, I also tried doing a hardcoded step by step call of readline and it would work until the number of calls to that method was less than the number of lines in the standard input.

For example, I was commiting one file change, which gave back 3 lines in the std input.

 

so doing

sys.stdin.read

sys.stdin.read

sys.stdin.read

worked just fine, but when i added the 4th

sys.stdin.read

sys.stdin.read

sys.stdin.read

sys.stdin.read

then it would hang forever

 

Here are is my simple test ruby script that hangs

 

------ RUBY-------

#!/usr/bin/env ruby

msg = "WHOOOO"

# Process stdin

STDIN.readlines.each do |line|

   msg += line

end # each

STDOUT.print msg

exit(1)

Link to comment
Share on other sites

  • 1 month later...
Quote

 It is as if plastic is not sending it an EOF, which is causing the standard input read/readline functions to never stop. 

It's been a while, any does anyone have any guidance? I cannot see what is wrong with the setup of the trigger. Please help!

-manish

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...