Re: [Fuego] Execute an utility in the host system from within the container

<[email protected]>
Newsgroups dev.linux.lists.fuego
Message-ID <[email protected]>

> -----Original Message-----
> From: Dhinakar Kalyanasundaram 
> 
> Dear Fuego Users,
> 
> 
> 
> I tried to execute the below command via a Jenkins job created in fuego
> dashboard.
> 
> Since Jenkins is running inside the container, I guess it is not able to access
> the host environment, unoconv execution fails.
> 
> Please check the below jenkins job content below.
> 
> …..
> 
> cd /fuego-rw/logs/Extract
> sh unoconv.sh
> 
> ……
> 
> 
> 
> Log output is as below.
> 
> …..
> 
> …..
> 
> + cd /fuego-rw/logs/Extract
> + sh unoconv.sh
> Pseudo-terminal will not be allocated because stdin is not a terminal.
> unoconv: RuntimeException during import phase:
> Office probably died. Unsupported URL <MergedReport.xlsx>: "type
> detection failed"
> Build step 'Execute shell' marked build as failure
> 
> 
> Finished: FAILURE
> ****************************************************
> 
> The content of unoconv.sh file is given below:
> 
> 
> 
> #!/bin/bash
> 
> sshpass -p test@2019 <mailto:test@2019>  ssh -o StrictHostKeyChecking=no
> [email protected] <mailto:[email protected]>  -t "cd
> /home/dhinakar/piper/fuego/fuego-rw/logs/Extract/htmlReports/; unoconv
> --listener; unoconv -f html MergedReport.xlsx"
> 
> 
> 
> Basically I want to process the raw log generated by fuego (kept under
> /fuego-rw/logs/Extract) and convert them into html report via python script.
> unoconv here is installed on host system.
> 
> What is the best way to invoke an utility or application running on host
> system from within the fuego container?

Dhinakar,

I presume that the test is being triggered from Jenkins.

Where is the call to "sh unoconv.sh"?  Is this in fuego_test.sh for some particular test?
What phase is it run in?

There are numerous IPCs you could use to communicate between the process in
the docker container and something on the host.  Probably the simplest would
be something file-based.

Here's an approach that's simple:
Inside the test, write the name of the log file you want to be converted into a 
file somewhere under /fuego-rw/ (maybe /fuego-rw/tmp/<tempfilename>)

Have a process on the host polling /fuego-rw/tmp for these files, and 
when they appear, read the filename, do the unoconv.sh operation, and
remove the file.

To avoid polling, you could use something from inotify-tools to use the Linux
inotify feature to get notifications of new files in the directory.
See https://developer.ibm.com/tutorials/l-ubuntu-inotify/

I hope this helps.
 -- Tim
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.