Problems with command dispatch to Windows Node

20 views
Skip to first unread message

Serban Alexe

unread,
Mar 26, 2010, 8:03:47 AM3/26/10
to ControlTier
Hello,

I'm having some problems with a Windows ControlTier Node, and I don't
know how to work around them... :(
(the windows node does have the os-family set to "cygwin") .

First:
from the Linux Server, I dispatch the following command to the
Windows node (cygwin with openssh):

ctl-exec -p Stage5 -I name=AS1 -- ctl -h

The command is executed completly, the output comes back ok, but at
the end it still reports an error:

ctl-exec -p Stage5 -I name=AS1 -- ctl -h
number of nodes to dispatch to: 1, (threadcount=1)
Connecting to AS1:22
cmd : ctl -h
usage: ctl [-h] [-v] [-V] [-z] [-p project -t type -o object -c
command] [-p
project -m module -c command] [--threadcount <1>] [-I filter] [-
X filter]
.........
.........
| ctl -p project -m poly -o greet -- -message hola
| => Runs the greet command passing in an argument
[CTL version 1.4.10 (20100303)]
error: Remote command failed with exit status 2


Second:
I created 2 custom types, one descending from Site and one from
Service, and 1 object of each type.
The Service type has 2 custom commands, as described below:

<command name="Halt" description="Halts the AS1Service."
command-type="Command" is-static="false">
<execution-string>cmd.exe</execution-string>
<argument-string>"${entity.attribute.as1Service-halt-script}"</
argument-string>
<opts>
<opt parameter="script" description="script to execute"
required="false" property="opts.script"
type="string" defaultproperty="entity.attribute.as1Service-halt-
script"/>
</opts>
</command>

<!-- echo "${entity.attribute.as1Service-run-script}" -->

<command name="Run" description="Runs the AS1Service."
command-type="Command" is-static="false">
<execution-string>cmd.exe</execution-string>
<argument-string>dir "c:\Windows\system32"</argument-string>
<opts>
<opt parameter="script" description="script to execute"
required="false" property="opts.script"
type="string" defaultproperty="entity.attribute.as1Service-run-
script"/>
</opts>
</command>

// yes, the "dir" command is just for testing purpose only, the
original version was identical to the first command, just that the
script to be ran is different.

The Site has same comands of type "DispatchCommand", dispatches them
to the Service, etc.

The Service objet is installed to the Windows Node, and BOTH COMMANDS
WORK OK when I run them FROM THE WINDOWS NODE.
(i.e. ctl -p Stage5 -t AS1Service -o aAs1ServiceInstance_01 -c Run )

The Site object is installed on the Server, and it controles the
Service, but running any of the commands on the Site DOES NOT WORK:

ctl -p Stage5 -t AS1Site -o aAS1SiteInstance_01 -c Run
// OR
ctl -p Stage5 -t AS1Site -o aAS1SiteInstance_01 -c HALT

Start: "Runs the Services configured for the Site." command: Run
Dispatching command 'Run ' to objects:
aAs1ServiceInstance_01[AS1Service] ...
starting: aAs1ServiceInstance_01[AS1Service] Run ...
Connecting to IBX-S09-AS1:22
cmd : ctl -p Stage5 -t AS1Service -o aAs1ServiceInstance_01 -c Run

Command failed: Access is denied
Error handler caught failed command execution:
aAs1ServiceInstance_01[AS1Service]#Run. reason: Remote command failed
with exit status 1
[command.timer.Stage5.AS1Site.Run: 6.577 sec]
Dispatch completed. execution time: 6.577 sec

I also tried to dispatch the command directly to the Service object,
via ctl-exec, from the Server.
Same result:

ctl-exec -p Stage5 -I name=AS1 -- ctl -p Stage5 -t AS1Service -o
aAs1ServiceInstance_01 -c Run
number of nodes to dispatch to: 1, (threadcount=1)
Connecting to IBX-S09-AS1:22
cmd : ctl -p Stage5 -t AS1Service -o aAs1ServiceInstance_01 -c Run

Command failed: Access is denied
error: Remote command failed with exit status 1

ctl-exec -p Stage5 -I name=AS1 -- ctl -p Stage5 -t AS1Service -o
aAs1ServiceInstance_01 -c Halt
number of nodes to dispatch to: 1, (threadcount=1)
Connecting to IBX-S09-AS1:22
cmd : ctl -p Stage5 -t AS1Service -o aAs1ServiceInstance_01 -c Halt

Command failed: Access is denied
error: Remote command failed with exit status 1

So ... I'm stuck with this ... :(

Can anybody help pe understand what I'm doing wrong ? What I forgot to
set, or how can I work around this ?

Thank you.

Serban Alexe

unread,
Mar 29, 2010, 8:27:09 AM3/29/10
to ControlTier
Hello,

I asked a question few days ago, and it's a very big problem for me,
so I'll ask again and try to express myself more clearly.

So, I have:
- custom Site installed on the Linux CTier Server
- custom Service installed on a Windows CTier Node
- two commands implemented on the Service and dispatchable from the
Site, that consist in simple Windows commands (execution of a bat
script and running a OS command).

I can run the commands on the Service object, (DIRECLTY on the Windows
Node: ctl -p ... -t MyServiceType -o myServiceObject =c cmd ) , but I
CAN NOT dispatch them from the Service (from the Site object or via
ctl-exec):
NONE of these works:

ctl -p .. -t MySiteType -o mySiteObject -c cmd OR ctl-exec -p ... -
I name=_win_node_name -- ctl -p ... -t MyServiceType -o
myServiceObject -c cmd .

I get the following error message:

Command failed: Access is denied
error: Remote command failed with exit status 1

So ... I'm pretty stuck with this, I can't figure out the solution or
a work-around... :(

Can you please help me ?

Here is the original thread: http://groups.google.com/group/controltier/browse_thread/thread/acb4e661962fc0a6#

Thank you.

Alex-SF

unread,
Mar 29, 2010, 11:32:07 AM3/29/10
to ControlTier
Hi Serban,
Make sure the Service and Site resources are assigned Nodes as child
resources. The dispatcher uses that information to know where to
execute remote commands.
Thanks

> Here is the original thread:http://groups.google.com/group/controltier/browse_thread/thread/acb4e...
>
> Thank you.

Alex-SF

unread,
Mar 29, 2010, 11:38:24 AM3/29/10
to ControlTier
Clarifying... the Site resource should be the child resource of the
server Node. The Service resources should be child resources to the
Windows client Nodes.

Greg Schueler

unread,
Mar 29, 2010, 2:18:52 PM3/29/10
to contr...@googlegroups.com
Hi Serban,

You should also try adding the -v (verbose) flag to see if there is any more error detail.

another thing to try: use SSH directly to connect to the node, and execute the "ctl" commandline.   e.g.: "ssh mywindowsnode" then "ctl -p ... -t MyServiceType -o myServiceObject -c cmd"

It sounds like there may be a permissions issue in executing something, and you will have to narrow down the cause.


--
You received this message because you are subscribed to the Google Groups "ControlTier" group.
To post to this group, send email to contr...@googlegroups.com
To unsubscribe from this group, send email to controltier...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/controltier?hl=en
http://wiki.controltier.org

To unsubscribe from this group, send email to controltier+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.

Serban Alexe

unread,
Mar 30, 2010, 9:02:11 AM3/30/10
to ControlTier
Hello again,

@Alex: my configuration does meet those requirements: the Site is a
child resource to the Server node, and the Service is a child resource
to the Windows Client Node.

@Greg: I followed both leads:

- IF I connect using ssh to the Windows Node and then I run the
command directly on the Service, IT WORKS .
(still it does not work if I use ctl-exec to dispatch the command
that is ran directly on the Service object )

- I ran both commands using -V

- on the Windows node: ctl -p Stage5 -V -t AS1Service -o
aAs1ServiceInstance_01 -c Run
- on the Linux Server node: ctl-exec -p Stage5 -I name=AS1 -- ctl -p
Stage5 -V -t AS1Service -o aAs1ServiceInstance_01 -c Run

The notable output differences appear only at the last execution
stage, the "-execute:" target of the "xml ant project" corresponding
to the specified command:
the first command works ok, the output shows success, the execution
is finalized ok.
the second command ends with a java.io.IOException :

-execute:

Command failed:
C:\ctier\ctl\depots\Stage5\modules\AS1Service\commands\Run.xml:24:
Access is denied
at com.controltier.ctl.tasks.ShellExec
$ScriptfileAction.<init>(ShellExec.java:207)
...
Caused by: java.io.IOException: Access is denied
...
... 30 more
--- Nested Exception ---
java.io.IOException: Access is denied
at java.io.WinNTFileSystem.createFileExclusively(Native Method)
at java.io.File.checkAndCreate(File.java:1704)
at java.io.File.createTempFile(File.java:1792)
...

And that's about it...

What else could I try ?

On Mar 29, 9:18 pm, Greg Schueler <g...@controltier.com> wrote:
> Hi Serban,
>
> You should also try adding the -v (verbose) flag to see if there is any more
> error detail.
>
> another thing to try: use SSH directly to connect to the node, and execute
> the "ctl" commandline.   e.g.: "ssh mywindowsnode" then "ctl -p ... -t
> MyServiceType -o myServiceObject -c cmd"
>
> It sounds like there may be a permissions issue in executing something, and
> you will have to narrow down the cause.
>

> >http://groups.google.com/group/controltier/browse_thread/thread/acb4e...

Serban Alexe

unread,
Apr 9, 2010, 11:15:48 AM4/9/10
to ControlTier
Hello,

I managed to fix this problem few days ago.
I thought I should put this info here, even though it's not exactly a
ControlTier issue, more likely a CygWin problem. So, here goes:

- when I installed cygwin on my windows machines destined to be
ControlTier nodes, I followed these instructions:
http://ist.uwaterloo.ca/~kscully/CygwinSSHD_W2K3.html , since I do
have Windows 2003 on them. It basically went ok, but I did not perform
the instructions from the last step called "Switching the user who
runs the service" , since that was not needed; the user under which
the CygWin SSHD Service was running did not need to have any special
domain privileges.

The problem turned out to be related to some user rights.

CygWin was mapping it's internal user accounts to the Windows User
Accounts (using the passwd file).
From that point forward, the commands dispatched from the CTier server
were ran using the credentials of user "sshd_server" (as configured on
the properties of service "CYGWIN SSHD" )
But that is done WRONG by the CYGWIN; the processes were started using
an INVALID user: it was a non-existent user, which had the name of the
windows user on which the CygWin user was mapped ( using the passwd
file, "salexe" in this case ) AND the SID of the "cygwin_sshd" server.
I'm not sure, but I belive that the windows OS was basically stopping
the entire execution because of this anomaly.

THE FIX: I changed the properties of the "CYGWIN SSHD" Service on the
windows nodes, so that it uses the same Windows User account on which
the cygwin is mapping it's internal user account.
So the "sshd_server" user was eliminated out of the equation, it's
"salexe" user from beggining to end.

As I previously said, it's not a ControlTier issue, but it might prove
to be useful for someone else having this problem...

Good Luck !

Reply all
Reply to author
Forward
0 new messages