Post

2 followers Follow
0
Avatar

Question: How to override the default remoteScript implementation - does not work as described?

In an attempt to change the connection types for the Unix and Windows remoteScript tasks (Unix to SSH with SFTP, using key files rather than passwords, Windows to SSH with SFTP_CYGWIN, also using key files), I came across a couple How-To articles discussing the same process:

  1. Edit the synthetic.xml in ext/
  2. Add ext/remoteScript and save Unix.py and Windows.py there

After restarting the XL Release server (to apply the changed synthetic) I attempt to create new remoteScript tasks and find based on the stack in the output that it's still attempting to use the old scripts. Wondering if this could just be some sort of compilation error, I replaced Windows.py with a single line, just a "Hello World" print statement. The tasks still fail with a stack indicating that it's trying to use the old scripts.

Has this functionality changed as of Version 4.7.1? I am following the instructions in the How-To articles to a T and yet it does not work as described.

Mike Carpenter Answered

Please sign in to leave a comment.

7 comments

0
Avatar

Hi Mike!

I'm sorry it's not working. I tried it just now and have no troubles here.

This is the contents of my ext dir:

$ ls -R ext
readme.txt remoteScript synthetic.xml

ext/remoteScript:
Unix.py

The 'Unix.py' has a simple print statement and that is reflected in the task output.

Can you share the synthetic XML?

Hes Siemelink 0 votes
0
Avatar

Thanks for the quick reply. My ext directory is the same. Here is the XML file:

<?xml version='1.0' encoding='UTF-8'?>
<synthetic xsi:schemaLocation="http://www.xebialabs.com/deployit/synthetic synthetic.xsd" xmlns="http://www.xebialabs.com/deployit/synthetic" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<type-modification type="remoteScript.Unix">
<property name="privateKeyFile" required="true" category="input" label="SSH Private Key File" />
<property name="password" category="input" default="none" hidden="true" />
<property name="connectionType" default="SFTP" category="input" hidden="true" />
</type-modification>
<type-modification type="remoteScript.Windows">
<property name="privateKeyFile" required="true" category="input" label="SSH Private Key File" />
<property name="password" category="input" default="none" hidden="true" />
<property name="timeout" default="PT60.000S" hidden="true" />
<property name="connectionType" default="SFTP_CYGWIN" category="input" hidden="true" />
</type-modification>
</synthetic>

The Windows.py script is a print statement, but this is my output:

Script failed:
Exit code
1

Output:

Error stream:

com.xebialabs.overthere.RuntimeIOException: Cannot determine existence of \[the remote machine]\C$\windows\temp\ot-20151006T092417924: jcifs.smb.SmbAuthException: Logon failure: unknown user name or bad password.
at com.xebialabs.overthere.cifs.CifsFile.exists(CifsFile.java:89)
at com.xebialabs.overthere.spi.BaseOverthereConnection.getTempFile(BaseOverthereConnection.java:188)
at com.xebialabs.overthere.spi.BaseOverthereConnection.getTempFile(BaseOverthereConnection.java:163)
at com.xebialabs.xlrelease.plugin.overthere.RemoteScript.execute(RemoteScript.java:43)
at com.xebialabs.xlrelease.plugin.overthere.WinrmRemoteScript.execute(WinrmRemoteScript.java:8)...

And so on. But from this it's clear that it's defaulting back to the script in the plugin JAR, since it's just a print statement. The inclusion of CIFS classes and WinrmRemoteScript were what originally clued me in to the fact that this was happening, as before switching it to a simple print statement I had switched it to SSH and SFTP, not WinRM and CIFS.

Mike Carpenter 0 votes
0
Avatar

Hi Mike, how frustrating!

I tried your synthetic.xml on a clean 4.7.1 installation with the dummy script in ext/remoteScript/Unix.py and it works.
You do see the changes in synthetic.xml being picked up?

Can only think of edge cases now
* Restart the server again...
* What OS are you on?
* Did you install XL Release with installer or with zip file?

Hes Siemelink 0 votes
0
Avatar

Yes, the changes in synthetic.xml are definitely picked up; it is only the scripts themselves that don't override. I have also managed to get custom task types working on this server (which had been removed to test this) and their scripts are picked up just fine. When I put them back in they work, even alongside the remoteScript overrides.

As for your other questions...

  • I have restarted XLR quite a few times, and just tried it again to be sure. Still no go.
  • XLR is running on Windows 7 Enterprise, 64-bit.
  • I installed with the installer executable.

Thanks for your continued help!

Mike Carpenter 0 votes
0
Avatar

Another thing you could try is to specify the script location in the synthetic.xml, and have it point to a script with another name.

<type-modification type="remoteScript.Unix">
<property name="scriptLocation" default="remoteScript/MyUnixTask.py" hidden="true" />
...

Hes Siemelink 0 votes
0
Avatar

I had tried that before to no effect, but had specified default="remoteScript/Unix.py" rather than renaming the script. Renaming to have another script name has worked. Thank you. Truly an odd problem.

Mike Carpenter 0 votes
1
Avatar

Turns out to be a bug in the startup script generated by the installer; it places 'lib' before 'ext' on the classpath so the original file is found before the overridden file.

Hes Siemelink 1 vote