Re: [openstack-dev] [openstackclient] Use and practices of --format shell for defining individual variables

2015-05-27 Thread Ronald Bradford
Thanks Doug,

I knew there would be a more definitive and simple use.
eval is that way!

Ronald


Ronald Bradford

Web Site: http://ronaldbradford.com
LinkedIn:  http://www.linkedin.com/in/ronaldbradford
Twitter:@RonaldBradford http://twitter.com/ronaldbradford
Skype: RonaldBradford
GTalk: Ronald.Bradford
IRC: rbradfor


On Tue, May 26, 2015 at 1:19 PM, Doug Hellmann d...@doughellmann.com
wrote:

 Excerpts from Ronald Bradford's message of 2015-05-26 11:18:09 -0400:
  Hi list,
 
  I came across the following neutron client specific syntax and decided to
  see if I could reproduce using the openstack client and it's flexible
  formatting capabilities
 
 
  $ NIC_ID1=$(neutron net-show public | awk '/ id /{print $4}')
 
  $  echo $NIC_ID1
  210d976e-16a3-42dc-ac31-f01810dbd297
 
  I can get similar syntax (unfortunately lowercase variable name only)
 with:
  NOTE: It may be nice to be able to pass an option to UPPERCASE all shell
  variables names.
 
  $ openstack network show public -c id --format shell --prefix nic_
  nic_id=210d976e-16a3-42dc-ac31-f01810dbd297
 
  However to use this I effectively have to place in a file and source that
  file to expose this variable to my current running shell.
  Reproducing the same syntax does not work obviously.

 It's actually meant to be used with an eval statement:

  $ eval $(openstack network show public -c id --format shell --prefix nic_)
  $ echo $nic_id

 Doug

 __
 OpenStack Development Mailing List (not for usage questions)
 Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
 http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


Re: [openstack-dev] [openstackclient] Use and practices of --format shell for defining individual variables

2015-05-26 Thread Dean Troyer
On Tue, May 26, 2015 at 10:18 AM, Ronald Bradford m...@ronaldbradford.com
wrote:

 I came across the following neutron client specific syntax and decided to
 see if I could reproduce using the openstack client and it's flexible
 formatting capabilities


I'll just say off the top it is unlikely as there are only two resources
implemented using the Network API.  The remaining networking functions use
the Compute API for nova-net.

We have not really mapped the requried commands to OSC form yet, that is
going to be the hardest part of implementing them.  They need to be
consistent with the rest of OSC.

Some of what you mentioned is common to all OSC commands, like the output
formatting is all done with cliff.  I don't know how much of that would be
common to neutronclient too since it also uses cliff, but sometimes in a
different way.

dt

-- 

Dean Troyer
dtro...@gmail.com
__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


Re: [openstack-dev] [openstackclient] Use and practices of --format shell for defining individual variables

2015-05-26 Thread Doug Hellmann
Excerpts from Ronald Bradford's message of 2015-05-26 11:18:09 -0400:
 Hi list,
 
 I came across the following neutron client specific syntax and decided to
 see if I could reproduce using the openstack client and it's flexible
 formatting capabilities
 
 
 $ NIC_ID1=$(neutron net-show public | awk '/ id /{print $4}')
 
 $  echo $NIC_ID1
 210d976e-16a3-42dc-ac31-f01810dbd297
 
 I can get similar syntax (unfortunately lowercase variable name only) with:
 NOTE: It may be nice to be able to pass an option to UPPERCASE all shell
 variables names.
 
 $ openstack network show public -c id --format shell --prefix nic_
 nic_id=210d976e-16a3-42dc-ac31-f01810dbd297
 
 However to use this I effectively have to place in a file and source that
 file to expose this variable to my current running shell.
 Reproducing the same syntax does not work obviously.

It's actually meant to be used with an eval statement:

 $ eval $(openstack network show public -c id --format shell --prefix nic_)
 $ echo $nic_id

Doug

__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev