FilePath problem with Clear case plugin when executed on an agent

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

FilePath problem with Clear case plugin when executed on an agent

Erik Ramfelt
I got a case when the CC plugin needs to list subfolders in a folder.
This works fins on the master machine but when I try to do the same
thing on an agent, it can not find any sub folders at all. Adding to
the problem is that the folder is outside the workspace on the agent
machine, it is actually a subst drive M:. Is there a problem accessing
folders outside the workspace?

Do I need to do any file.act(new FileCallable<Void>() {} to get the info I need?


Heres the excerpt from the code itself:
---------------------------------------------------------------
String viewName = "kmws07_local_view";
String viewDrive = "m:";
FilePath viewPath =  new FilePath(new File(viewDrive)).child(viewName);

if (! viewPath.exists())
{
    launcher.getListener().fatalError("No view found at '" + viewPath
+ ",exists=" + viewPath.exists()  + "', root view path='" +
getRootViewPath(launcher) + ",exists=" +
getRootViewPath(launcher).exists() + "'. Create the view by initiating
a build manually.");^M
}
---------------------------------------------------------------


Below is the console output
---------------------------------------------------------------
started
Building remotely on kmws07
FATAL: No view found at 'm:\kmws07_local_view,exists=false', root view
path='m:,exists=true'. Create the view by initiating a build manually.
---------------------------------------------------------------
Note, that "m:\" exists locally on the master machine.


Batch command that does "dir m:\kmws07_local_view"
---------------------------------------------------------------
c:\hudson\data\workspace\kmws07 - Build>dir m:\kmws07_local_view
 Volymen i enhet M har etiketten CCase
 Volymens serienummer „r 0234-5789

 Inneh†ll i katalogen m:\kmws07_local_view

2007-11-13  13:11    <KAT>          .
2007-11-13  13:11    <KAT>          ..
2007-11-13  13:11    <KAT>          ddd_code
2007-11-13  13:11    <KAT>          aaa_code
2007-11-13  13:11    <KAT>          bbb_proj
2007-11-13  13:11    <KAT>          ccl
---------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: FilePath problem with Clear case plugin when executed on an agent

Erik Ramfelt
Ok, now i understand why it didnt work, the constructor FilePath(File)
is only used for local files on the master machine. In order to get a
path outside the workspace on an agent I should have used "new
FilePath(workspace.getChannel(), viewDrive)".

//Erik

On Nov 13, 2007 2:26 PM, Erik Ramfelt <[hidden email]> wrote:

> I got a case when the CC plugin needs to list subfolders in a folder.
> This works fins on the master machine but when I try to do the same
> thing on an agent, it can not find any sub folders at all. Adding to
> the problem is that the folder is outside the workspace on the agent
> machine, it is actually a subst drive M:. Is there a problem accessing
> folders outside the workspace?
>
> Do I need to do any file.act(new FileCallable<Void>() {} to get the info I need?
>
>
> Heres the excerpt from the code itself:
> ---------------------------------------------------------------
> String viewName = "kmws07_local_view";
> String viewDrive = "m:";
> FilePath viewPath =  new FilePath(new File(viewDrive)).child(viewName);
>
> if (! viewPath.exists())
> {
>     launcher.getListener().fatalError("No view found at '" + viewPath
> + ",exists=" + viewPath.exists()  + "', root view path='" +
> getRootViewPath(launcher) + ",exists=" +
> getRootViewPath(launcher).exists() + "'. Create the view by initiating
> a build manually.");^M
> }
> ---------------------------------------------------------------
>
>
> Below is the console output
> ---------------------------------------------------------------
> started
> Building remotely on kmws07
> FATAL: No view found at 'm:\kmws07_local_view,exists=false', root view
> path='m:,exists=true'. Create the view by initiating a build manually.
> ---------------------------------------------------------------
> Note, that "m:\" exists locally on the master machine.
>
>
> Batch command that does "dir m:\kmws07_local_view"
> ---------------------------------------------------------------
> c:\hudson\data\workspace\kmws07 - Build>dir m:\kmws07_local_view
>  Volymen i enhet M har etiketten CCase
>  Volymens serienummer „r 0234-5789
>
>  Inneh†ll i katalogen m:\kmws07_local_view
>
> 2007-11-13  13:11    <KAT>          .
> 2007-11-13  13:11    <KAT>          ..
> 2007-11-13  13:11    <KAT>          ddd_code
> 2007-11-13  13:11    <KAT>          aaa_code
> 2007-11-13  13:11    <KAT>          bbb_proj
> 2007-11-13  13:11    <KAT>          ccl
> ---------------------------------------------------------------
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: FilePath problem with Clear case plugin when executed on an agent

Kohsuke Kawaguchi
Administrator
In reply to this post by Erik Ramfelt
Erik Ramfelt wrote:

> I got a case when the CC plugin needs to list subfolders in a folder.
> This works fins on the master machine but when I try to do the same
> thing on an agent, it can not find any sub folders at all. Adding to
> the problem is that the folder is outside the workspace on the agent
> machine, it is actually a subst drive M:. Is there a problem accessing
> folders outside the workspace?
>
> Do I need to do any file.act(new FileCallable<Void>() {} to get the info I need?
>
>
> Heres the excerpt from the code itself:
> ---------------------------------------------------------------
> String viewName = "kmws07_local_view";
> String viewDrive = "m:";
> FilePath viewPath =  new FilePath(new File(viewDrive)).child(viewName);
This creates a local file path --- local here means the machine where
this line was executed.

To create a remote file path, use the "FilePath(VirtualChannel channel,
String remote)" version. You can get the channel from Launcher.getChannel().

Another way to do this is to execute "new FilePath(new File(viewDrive))"
on the slave and then send back the result to the master. By the time
you get it back on the master it correctly points to the slave.



> if (! viewPath.exists())
> {
>     launcher.getListener().fatalError("No view found at '" + viewPath
> + ",exists=" + viewPath.exists()  + "', root view path='" +
> getRootViewPath(launcher) + ",exists=" +
> getRootViewPath(launcher).exists() + "'. Create the view by initiating
> a build manually.");^M
> }
> ---------------------------------------------------------------
>
>
> Below is the console output
> ---------------------------------------------------------------
> started
> Building remotely on kmws07
> FATAL: No view found at 'm:\kmws07_local_view,exists=false', root view
> path='m:,exists=true'. Create the view by initiating a build manually.
> ---------------------------------------------------------------
> Note, that "m:\" exists locally on the master machine.
>
>
> Batch command that does "dir m:\kmws07_local_view"
> ---------------------------------------------------------------
> c:\hudson\data\workspace\kmws07 - Build>dir m:\kmws07_local_view
>  Volymen i enhet M har etiketten CCase
>  Volymens serienummer ?r 0234-5789
>
>  Inneh?ll i katalogen m:\kmws07_local_view
>
> 2007-11-13  13:11    <KAT>          .
> 2007-11-13  13:11    <KAT>          ..
> 2007-11-13  13:11    <KAT>          ddd_code
> 2007-11-13  13:11    <KAT>          aaa_code
> 2007-11-13  13:11    <KAT>          bbb_proj
> 2007-11-13  13:11    <KAT>          ccl
> ---------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

--
Kohsuke Kawaguchi
Sun Microsystems                   [hidden email]

smime.p7s (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: FilePath problem with Clear case plugin when executed on an agent

Kohsuke Kawaguchi
Administrator
In reply to this post by Erik Ramfelt
Erik Ramfelt wrote:
> Ok, now i understand why it didnt work, the constructor FilePath(File)
> is only used for local files on the master machine. In order to get a
> path outside the workspace on an agent I should have used "new
> FilePath(workspace.getChannel(), viewDrive)".

Yes. I updated the documents.

--
Kohsuke Kawaguchi
Sun Microsystems                   [hidden email]

smime.p7s (4K) Download Attachment