RHEV CLI output redirection does not work from within a script executed by the 'file' command.
Issue
Redirection of output specified in a RHEV CLI script executed using the 'file' command fails. For example, a script called 'start_tagged' contains;
list vms --query "tag = gfwtag" | grep name | sed s/'name :'/'action vm'/ | sed -e 's/$/ start/' > /home/gfw/stv
file /home/gfw/stv
This script is then executed using the 'file' command;
[RHEVM shell (connected)]# file /home/gfw/start_tagged
This generates the following output;
[RHEVM shell (connected)]# list vms --query "tag = gfwtag" | grep name | sed s/'name :'/'action vm'/ | sed -e 's/$/ start/' > /home/gfw/stv
id : 2a7b8ec8-4c42-47bd-a27a-01df8f12e085
name : iscsi-vm
id : f6d75946-6d5a-47e0-9946-0110a80f330b
name : Steve-RHEL5_7_Copy
description: Steve's VM
[RHEVM shell (connected)]# file /home/gfw/stv
error: [Errno 2] No such file or directory: '/home/gfw/stv'
As can be seen the output file does not get created.
Environment
- Red Hat Enterprise Virtualization (RHEV) 3.1
- Red Hat Enterprise Virtualization Command Line Shell (RHEV CLI)
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.