Jump to content


Invalid Password on Trigger

trigger

  • Please log in to reply
1 reply to this topic

#1 chrisb

chrisb

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 07 September 2018 - 06:46 PM

Hello,

I created a change-content trigger to run a Python script every time a user submits a changelist. The script takes the change number as input and then retrieves the file location and contents. When I run the script on its own (i.e
python myScript.py
) it works just fine. But when it is run via the trigger I get an error that says 'Perforce password (P4PASSWD) invalid or unset.'

The line of code in the script that triggers this is
fileCmd = "p4 -G files @=" + change_nbr
content = os.popen(fileCmd, 'r')

Any help is appreciated.

Thanks

#2 Sambwise

Sambwise

    Advanced Member

  • Members
  • PipPipPip
  • 588 posts

Posted 10 September 2018 - 02:30 PM

When you run the script in your shell, it's picking up your P4USER and P4PASSWD/P4TICKETS from your shell environment.

When you run the script in your trigger, it's using whatever client environment is set up on the server machine (probably none).  Typically when running a command in a trigger you want to set the trigger up with a user name and a pre-generated authentication ticket, e.g.:

p4 -u trigger_user login -p
Enter password:
174074B005A5CE722515191EB3EA4E4C


fileCmd = "p4 -u trigger_user -P 174074B005A5CE722515191EB3EA4E4C -G files @=" + change_nbr






Also tagged with one or more of these keywords: trigger

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users