Formatação de saída
O AVCLI pode criar uma saída de comando de fácil utilização e uma saída de XML de fácil programação.
Saída de comando de fácil utilização
A saída do AVCLI é formatada para fácil leitura.
Por exemplo:
$ avance -u admin -p admin -H avance –x node-info
node:
-> name : node0
-> id : host:o14
-> state: running
-> sub-state : nil
-> standing-state : maintenance
-> mode : maintenance
-> primary : false
-> manufacturer : Dell
-> model : Dell PowerEdge 2950
-> maintenance-allowed : true
-> maintenance-guest-shutdown : false
-> cpus : 8
-> memory : 4,288,675,840
virtual machines:
node:
-> name : node1
-> id : host:o406
-> state : running
-> sub-state : nil
-> standing-state : warning
-> mode : normal
-> primary : true
-> manufacturer : Dell
-> model : Dell PowerEdge 2950
-> maintenance-allowed : true
-> maintenance-guest-shutdown : true
-> cpus : 8
-> memory : 4,288,675,840
virtual machines:
virtual machine:
-> name : eagles1
-> id : vm:o1836
Observação: O formato de saída destes comandos pode variar de acordo com a versão.
Saída de XML de fácil programação
É possível criar uma saída de XML de fácil programação usando-se a opção global -x ou --xml.
Por exemplo:
$ avcli -u admin -p admin -H localhost -x node-info
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<avance>
<node>
<name>node1</name>
<id>host:o55</id>
<state>running</state>
<sub-state/>
<standing-state>normal</standing-state>
<mode>normal</mode>
<primary>false</primary>
<manufacturer>Intel Corporation</manufacturer>
<model>S5520UR</model>
<maintenance-allowed>true</maintenance-allowed>
<maintenance-guest-shutdown>false</maintenance-guest-shutdown>
<cpus>2</cpus>
<memory>25706889216</memory>
<virtual-machines/>
</node>
<node>
<name>node0</name>
<id>host:o23</id>
<state>running</state>
<sub-state/>
<standing-state>normal</standing-state>
<mode>normal</mode>
<primary>true</primary>
<manufacturer>Intel Corporation</manufacturer>
<model>S5520UR</model>
<maintenance-allowed>true</maintenance-allowed>
<maintenance-guest-shutdown>false</maintenance-guest-shutdown>
<cpus>2</cpus>
<memory>25706889216</memory>
<virtual-machines>
<virtual-machine>
<name>MyVM</name>
<id>vm:o6417</id>
</virtual-machine>
</virtual-machines>
</node>
</avance>
Observação: A definição de esquema é mantida entre as versões.
Se não for especificado –X ou --XML e o comando retornar um erro, será exibida uma mensagem detalhada. Por exemplo:
$ cli -H eagles vm-delete eagles23
%Error: Cannot find a resource that matches the identifier eagles23.
com.avance.yak.cli.exceptions.CommandLineException: Cannot find a resource that matches the identifier eagles23.
at com.avance.yak.cli.ResourceDisambiguateServiceProvider.throwNonExistentResource(ResourceDisambiguateServiceProvider.java:56)
at
com.avance.yak.cli.ResourceDisambiguateServiceProvider.getResourceId(ResourceDisambiguateServiceProvider.java:81)
at
com.avance.yak.cli.Command.findResourceId(Command.java:80)
at com.avance.yak.cli.CommandWithUnparsedAmbiguousResourcesInvokeEach.execute(CommandWithUnparsedAmbiguousResourcesInvokeEach.java:65)
at
com.avance.yak.cli.Command.execute(Command.java:194)
at
com.avance.yak.cli.CommandLine.execute(CommandLine.java:649)
at