bump cliff version now that cliff-tablib has been removed
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
python-openstackclient |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
If cliff-tablib is installed, the output of openstack server show -f json is an array such as:
[{"Field": "OS-DCF:
if cliff-tablib is not installed, the output of openstack server show -f json is dictionary such as:
{
"OS-EXT-
"addresses": "Ext-Net=
"image": "teuthology-
"OS-EXT-
this variance makes it difficult for scripts to use the output consistently as they have to detect the type of the output and use different codepath to find the value of a given field. A few weeks ago, cliff-tablib was an indirect dependency of pip install python-openstack client there was a single output format, the array format. Then the indirect dependency was dropped and cliff-tablib may or may not be installed which introduces the problem.
This variance can easily be resolved by adding cliff-tablib as a direct dependency of python-
Steve Martinelli (stevemar) wrote : | #1 |
Changed in python-openstackclient: | |
status: | New → Triaged |
importance: | Undecided → Medium |
assignee: | nobody → Steve Martinelli (stevemar) |
summary: |
- openstack server show output format is either a dict or an array + bump cliff version now that cliff-tablib has been removed |
Changed in python-openstackclient: | |
status: | Triaged → In Progress |
Steve Martinelli (stevemar) wrote : | #2 |
Loic Dachary (dachary) wrote : | #3 |
Even with cliff 1.15.0, the presence or absence of the cliff-tablib module changes the output.
(virtualenv)
{
"OS-EXT-
"addresses": "Ext-Net=
"image": "teuthology-
"OS-EXT-
"OS-SRV-
"flavor": "eg-30 (3c1d6170-
"id": "affbd6b5-
"security_
{
"name": "teuthology"
}
],
"user_id": "291dde16331548
"OS-DCF:
"accessIPv4": "",
"accessIPv6": "",
"progress": 0,
"OS-EXT-
"project_id": "131b886b156a4f
"config_drive": "",
"status": "ACTIVE",
"updated": "2015-11-
"hostId": "fcb073c0ed699b
"OS-SRV-
"key_name": "myself",
"properties": "",
"OS-EXT-
"name": "teuthology",
"created": "2015-11-
"os-extended-
}(virtualenv)
*** output flushed ***
(virtualenv)
cliff (1.15.0)
(virtualenv)
Collecting cliff-tablib
Installing collected packages: cliff-tablib
Successfully installed cliff-tablib-1.1
(virtualenv)
[{"Field": "OS-DCF:
Steve Martinelli (stevemar) wrote : | #4 |
@loic, right, on old environments that have cliff-tablib installed we won't be able to fix. but going forward, OSC should only depend on cliff not cliff-tablib. i doubt we can do much about existing installations with tablib installed
Loic Dachary (dachary) wrote : | #5 |
@stevemar this is not limited to old environment. If cliff-tablib is installed by the user, because she/he wants this module for some reason or as a dependency of another a module entirely unrelated to python-
Do you think it is unreasonable to expect that the output of python-
Steve Martinelli (stevemar) wrote : | #6 |
maybe i'm missing something, but i didn't think OSC would be picking up any traces of cliff-tablib any longer.
adding dhellmann, maybe he knows whats going on
Steve Martinelli (stevemar) wrote : | #7 |
do i need to have metadata or something? i'm not seeing it on osc-master and cliff 1.15.0
$ pip freeze | grep cliff
cliff==1.15.0
$ openstack user show admin -f json
{
"username": "admin",
"enabled": true,
"id": "afb907505fdb41
"name": "admin"
}
$ pip install cliff-tablib
Collecting cliff-tablib
Requirement already satisfied (use --upgrade to upgrade): cliff in /usr/local/
Requirement already satisfied (use --upgrade to upgrade): tablib in /usr/local/
Requirement already satisfied (use --upgrade to upgrade): cmd2>=0.6.7 in /usr/local/
Requirement already satisfied (use --upgrade to upgrade): argparse in /usr/local/
Requirement already satisfied (use --upgrade to upgrade): pyparsing>=2.0.1 in /usr/local/
Requirement already satisfied (use --upgrade to upgrade): stevedore>=1.5.0 in /usr/local/
Requirement already satisfied (use --upgrade to upgrade): unicodecsv>=0.8.0 in /usr/local/
Requirement already satisfied (use --upgrade to upgrade): six>=1.9.0 in /usr/local/
Requirement already satisfied (use --upgrade to upgrade): PyYAML>=3.1.0 in /usr/local/
Requirement already satisfied (use --upgrade to upgrade): pbr<2.0,>=1.4 in /usr/local/
Requirement already satisfied (use --upgrade to upgrade): PrettyTable<
Installing collected packages: cliff-tablib
Successfully installed cliff-tablib-1.1
$ pip freeze | grep cliff
cliff==1.15.0
cliff-tablib==1.1
$ openstack user show admin -f json
{
"username": "admin",
"enabled": true,
"id": "afb907505fdb41
"name": "admin"
}
Loic Dachary (dachary) wrote : | #8 |
Here are the steps to reproduce:
* provision a fresh Ubuntu 14.04
* sudo apt-get install git
* git clone http://
* cd teuthology
* ./bootstrap install
* source virtualenv/
* source openrc.sh # your own openrc.sh ;-)
* openstack server show -f json a server
After running the steps above, the list of python modules installed is:
ansible (1.9.2)
appdirs (1.4.0)
apt-xapian-index (0.45)
Babel (2.1.1)
beanstalkc (0.4.0)
boto (2.38.0)
bunch (1.0.1)
cffi (1.3.1)
chardet (2.0.1)
Cheetah (2.4.4)
cliff (1.15.0)
cliff-tablib (1.1)
cloud-init (0.7.5)
cmd2 (0.6.8)
colorama (0.2.5)
configobj (5.0.6)
configparser (3.3.0.post2)
cryptography (1.1.1)
debtcollector (1.0.0)
docopt (0.6.2)
ecdsa (0.13)
enum34 (1.0.4)
functools32 (3.2.3.post2)
gevent (1.0.2)
greenlet (0.4.9)
html5lib (0.999)
httplib2 (0.9.2)
idna (2.0)
ipaddress (1.0.15)
iso8601 (0.1.11)
Jinja2 (2.8)
jsonpatch (1.12)
jsonpointer (1.10)
jsonschema (2.5.1)
keystoneauth1 (1.2.0)
Landscape-Client (14.12)
libvirt-python (1.2.2)
MarkupSafe (0.23)
meld3 (0.6.10)
monotonic (0.4)
msgpack-python (0.4.6)
MySQL-python (1.2.3)
ndg-httpsclient (0.4.0)
netaddr (0.7.18)
netifaces (0.10.4)
oauth (1.0.1)
os-client-config (1.12.0)
oslo.config (3.0.0)
oslo.i18n (3.0.0)
oslo.serialization (2.0.0)
oslo.utils (3.0.0)
PAM (0.4.2)
paramiko (1.16.0)
pbr (1.8.1)
pexpect (4.0.1)
pip (7.1.2)
prettytable (0.7.2)
psutil (3.3.0)
ptyprocess (0.5)
py (1.4.30)
pyasn1 (0.1.9)
pycparser (2.14)
pycrypto (2.6.1)
pycurl (7.19.3)
pyOpenSSL (0.15.1)
pyparsing (2.0.6)
pyserial (2.6)
pytest (2.8.3)
python-apt (0.9.3.5ubuntu1)
python-cinderclient (1.4.0)
python-debian (0.1.21-
python-glanceclient (1.2.0)
python-
python-
python-novaclient (2.35.0)
python-
pytz (2015.7)
PyYAML (3.11)
raven (5.8.1)
requests (2.8.1)
requestsexceptions (1.1.1)
setuptools (18.5)
simplejson (3.8.1)
six (1.10.0)
ssh-import-id (3.21)
stevedore (1.9.0)
supervisor (3.0b2)
tablib (0.10.0)
teuthology (0.1.0, /home/ubuntu/
Twisted-Core (13.2.0)
Twisted-Names (13.2.0)
Twisted-Web (13.2.0)
unicodecsv (0.14.1)
urllib3 (1.7.1)
virtualenv (1.11.4)
warlock (1.2.0)
web.py (0.37)
wheel (0.24.0)
wrapt (1.10.5)
zope.interface (4.0.5)
Loic Dachary (dachary) wrote : | #9 |
Although it is probably obvious, here are the steps after the install:
(virtualenv)
[{"Field": "OS-DCF:
(virtualenv)
Uninstalling cliff-tablib-1.1:
/home/
/home/
/home/
/home/
/home/
/home/
/home/
/home/
/home/
/home/
/home/
/home/
Proceed (y/n)? y
Successfully uninstalled cliff-tablib-1.1
(virtualenv)
{
"OS-EXT-
"addresses": "Ext-Net=
"image": "teuthology-
"OS-EX...
Manavalan Krishnan (manavalan-krishnan-s) wrote : | #10 |
It looks we hit similar issue when we run the openstack teuthology as per instruction given at: https:/
I get the following error when i run teuthology-
2015-12-05 14:57:58,203.203 DEBUG:teutholog
Traceback (most recent call last):
File "./virtualenv/
load_
File "/schooner/
sys.
File "/schooner/
return TeuthologyOpenS
File "/schooner/
self.setup()
File "/schooner/
self.
File "/schooner/
self.instance = OpenStackInstan
File "/schooner/
self.set_info()
File "/schooner/
lambda p: (p['Field'
File "/schooner/
lambda p: (p['Field'
TypeError: string indices must be integers
Output of "pip list installed" and "type python" given below.
(virtualenv)
ansible (1.9.2)
appdirs (1.4.0)
apt-xapian-index (0.45)
Babel (2.1.1)
beanstalkc (0.4.0)
blinker (1.3)
boto (2.38.0)
bunch (1.0.1)
cffi (1.3.1)
chardet (2.0.1)
cliff (1.15.0)
cliff-tablib (1.1)
cmd2 (0.6.8)
colorama (0.2.5)
configobj (5.0.6)
configparser (3.3.0.post2)
cryptography (1.1.1)
debtcollector (1.0.0)
docopt (0.6.2)
docutils (0.11)
ecdsa (0.13)
enum34 (1.1.1)
functools32 (3.2.3.post2)
gevent (1.0.2)
greenlet (0.4.9)
html5lib (0.999)
httplib2 (0.9.2)
idna (2.0)
ipaddress (1.0.15)
iso8601 (0.1.11)
itsdangerous (0.22)
Jinja2 (2.8)
jsonpatch (1.12)
jsonpointer (1.10)
jsonschema (2.5.1)
keystoneauth1 (2.0.0)
Landscape-Client (14.12)
libvirt-python (1.2.2)
MarkupSafe (0.23)
monotonic (0.4)
msgpack-python (0.4.6)
MySQL-python (1.2.3)
ndg-httpsclient (0.4.0)
netaddr (0.7.18)
netifaces (0.10.4)
nose (1.3.1)
os-client-config (1.12.0)
oslo.config (3.0.0)
oslo.i18n (3.0.0)
oslo.serialization (2.0.0)
oslo.utils (3.0.0)
PAM (0.4.2)
paramiko (1.16.0)
pbr (1.8.1)
pexpect (4.0.1)
Pillow (2.3.0)
pip (7.1.2)
prettytable (0.7.2)
psutil (3.3.0)
ptyprocess (0.5)
py (1.4.31)
pyasn1 (0.1.9)
pycparser (2.14)
pycrypto (2.6.1)
Pygments (1.6)
pyinotify (0.9.4)
pyOpenSSL (0.15.1)
pyparsing (2.0.6)
pyserial (2.6)
pytest (2.8.3)
python-apt (0.9.3.5ubuntu1)
python-cindercl...
Loic Dachary (dachary) wrote : | #11 |
@manavalan-
The deeper problem is that the python-
Loic Dachary (dachary) wrote : | #12 |
s/the python-
Steve Martinelli (stevemar) wrote : | #13 |
i'm at my wits end here guys, i've tried to reproduce this three times and i can't:
$ pip freeze | grep cliff
cliff==1.15.0
cliff-tablib==1.1
$ openstack server show my_serv --format json
{
"OS-EXT-
"addresses": "private=10.0.0.2",
"image": "cirros-
"OS-EXT-
"OS-EXT-
"OS-SRV-
"flavor": "m1.tiny (1)",
"id": "e2ebabea-
"security_
{
"name": "default"
}
],
"user_id": "37f71514c0e942
"OS-DCF:
"accessIPv4": "",
"accessIPv6": "",
"progress": 0,
"OS-EXT-
"OS-EXT-
"config_drive": "True",
"status": "ACTIVE",
"updated": "2015-12-
"hostId": "97803136f965cd
"OS-EXT-
"OS-SRV-
"key_name": null,
"properties": "key1='value1'",
"project_id": "72ec36d95f8542
"OS-EXT-
"name": "my_serv",
"created": "2015-12-
"os-extended-
}
Is modifiying teuthology-
In all seriousness, the cliff-tablib library is unmaintained (it is failing to build on pypi: https:/
Changed in python-openstackclient: | |
assignee: | Steve Martinelli (stevemar) → nobody |
importance: | Medium → Undecided |
status: | In Progress → Opinion |
Steve Martinelli (stevemar) wrote : | #14 |
I've moved it to 'opinion', and unassigned myself, i have other things to work on. If someone else wants to pick it up, or can reproduce the error, they can do so. But as it stands, I can't. Since there is some desire from the original reporter to keep it alive, I won't mark it as incomplete for now.
Loic Dachary (dachary) wrote : | #15 |
> If someone else wants to pick it up, or can reproduce the error, they can do so. But as it stands, I can't.
Can you please confirm you followed the instructions to reproduce and found a different behavior than what is reported ?
* provision a fresh Ubuntu 14.04
* sudo apt-get install git
* git clone http://
* cd teuthology
* ./bootstrap install
* source virtualenv/
* source openrc.sh # your own openrc.sh ;-)
* openstack server show -f json a server
Loic Dachary (dachary) wrote : | #16 |
> I've moved it to 'opinion', and unassigned myself, i have other things to work on.
I'd like to point out that this phrase makes me feel like I've wasted your valuable time. It is a strong incentive to not report bugs should I find one. I assume this is written out of frustration.
Steve Martinelli (stevemar) wrote : | #17 |
> I assume this is written out of frustration.
It was.
> It is a strong incentive to not report bugs should I find one.
Not my intention, we actually have a pretty good track record for resolving bugs, quickly too.
I'll follow the instructions, but at what point does it become an OSC bug vs a bug against teuthology?
Steve Martinelli (stevemar) wrote : | #18 |
FWIW, this code looks hella suspicious: https:/
def set_info(self):
try:
info = json.loads(
except CalledProcessError:
Steve Martinelli (stevemar) wrote : | #19 |
SO... when I don't use a virtualenv, things are fine:
stevemar@
{
"OS-EXT-
"addresses": "private=10.0.0.2",
"image": "cirros-
"OS-EXT-
"OS-EXT-
"OS-SRV-
"flavor": "m1.tiny (1)",
"id": "b88bb13d-
"security_
{
"name": "default"
}
],
"user_id": "736e8e5dcb0441
"OS-DCF:
"accessIPv4": "",
"accessIPv6": "",
"progress": 0,
"OS-EXT-
"OS-EXT-
"config_drive": "True",
"status": "ACTIVE",
"updated": "2015-12-
"hostId": "3c5806fe3f28c6
"OS-EXT-
"OS-SRV-
"key_name": null,
"properties": "",
"project_id": "62d97cd7b46741
"OS-EXT-
"name": "my_serv",
"created": "2015-12-
"os-extended-
}
stevemar@
cliff (1.15.0)
cliff-tablib (1.1)
stevemar@
ndg-httpsclient (0.4.0)
os-client-config (1.12.0)
piston-mini-client (0.7.5)
python-cinderclient (1.5.0)
python-glanceclient (1.2.0)
python-
python-
python-novaclient (2.35.0)
python-
Steve Martinelli (stevemar) wrote : | #20 |
when I use a virtual environment, i get:
stevemar@
(virtualenv)
[{"Field": "OS-DCF:
(virtualenv)
cliff (1.15.0)
cliff-tablib (1.1)
(virtualenv)
ndg-httpsclient (0.4.0)
os-client-config (1.12.0)
piston-mini-client (0.7.5)
python-cinderclient (1.5.0)
python-glanceclient (1.2.0)
python-
python-
python-novaclient (2.35.0)
python-
Steve Martinelli (stevemar) wrote : | #21 |
#19 and #20 were both run on a VM with the steps to reproduce the issue
Steve Martinelli (stevemar) wrote : | #22 |
Same thing with user show, so it's not just server show.
(virtualenv)
[{"Field": "enabled", "Value": true}, {"Field": "id", "Value": "736e8e5dcb0441
(virtualenv)
stevemar@
{
"username": "admin",
"enabled": true,
"id": "736e8e5dcb0441
"name": "admin"
}
Can you confirm you are seeing the same behavior?
Steve Martinelli (stevemar) wrote : | #23 |
Using a non-teuthology virtual environment, i get normal looking results:
stevemar@
stevemar@
(virt1)
(virt1)
OS_PASSWORD=
OS_AUTH_URL=http://
OS_USERNAME=admin
OS_TENANT_
(virt1)
{
"OS-EXT-
"addresses": "private=10.0.0.2",
"image": "cirros-
"OS-EXT-
"OS-EXT-
"OS-SRV-
"flavor": "m1.tiny (1)",
"id": "b88bb13d-
"security_
{
"name": "default"
}
],
"user_id": "736e8e5dcb0441
"OS-DCF:
"accessIPv4": "",
"accessIPv6": "",
"progress": 0,
"OS-EXT-
"OS-EXT-
"config_drive": "True",
"status": "ACTIVE",
"updated": "2015-12-
"hostId": "3c5806fe3f28c6
"OS-EXT-
"OS-SRV-
"key_name": null,
"properties": "",
"project_id": "62d97cd7b46741
"OS-EXT-
"name": "my_serv",
"created": "2015-12-
"os-extended-
}
Steve Martinelli (stevemar) wrote : | #24 |
I get normal output with:
- vanilla OSC installed as a system wide package.
- a vanilla virtualenv (created with `virtualenv virt`), then OSC installed.
- a bunch of installed stuff n' things from tuethology and not activating the virualenv provided by tuethology.
I get incorrect output with:
- activating the virtualenv provided by the tuethology scripts.
Changed in python-openstackclient: | |
status: | Opinion → Incomplete |
Steve Martinelli (stevemar) wrote : | #25 |
Set the status to 'incomplete', not really sure how you want me to proceed. I don't intend to start digging into tuethology code.
Loic Dachary (dachary) wrote : | #26 |
@stevamar here are the minimal steps to reproduce (without teuthology):
provision a fresh Ubuntu 14.04
source openrc.sh
sudo apt-get update
sudo apt-get install -y python-virtualenv python-dev
virtualenv virtualenv
source virtualenv/
pip install 'cliff-tablib' 'python-
openstack server show myserver -f json
Steve Martinelli (stevemar) wrote : | #27 |
So, I was able to reproduce this on a fresh system with the steps written in #26 - hurray! virtual environments be damned, it happens when installed globally, too. So we can cross that off our list of possible reasons, along with tuethology affecting it.
I checked on my dev environment, where the error *never* occurs (for whatever reason), I installed and uninstalled cliff and cliff-tablib a bunch of times - no change.
On my new fresh box the results were more interesting. If i uninstalled cliff-tablib, then the output was nicely formatted in the new format, as expected. If I re-installed cliff-tablib, it was the old output (Field / Value in the JSON) that's been reported.
Looking at cliff and cliff-tablib, I see that they share similar entry points:
cliff-tablib
---------------
entry_points={
'yaml = clifftablib.
'html = clifftablib.
'json = clifftablib.
],
},
cliff
------
cliff.formatter
table = cliff.formatter
shell = cliff.formatter
value = cliff.formatter
yaml = cliff.formatter
json = cliff.formatter
Maybe it's the way the entry points are processed? Depending on what package was installed first then that's what it'll use going forward? I don't know. I checked stevedore, and it was at the same level on both machines. I tried re-installing a bunch of times and the behavior persisted.
Short of renaming the entry points, which I'm not even sure would fix the problem, and may cause more problems, I don't know of an easy solution for this issue. Uninstalling cliff-tablib should resolve the issue on any environment. But as @Loic said, it's possible someone is using this for other purposes. My counter to that is there hasn't been a meaningful commit to that repo in over 2.5 years (https:/
I'm going to move this to new so it shows up in OSC's open bug list.
Loic Dachary (dachary) wrote : | #28 |
In light of this, I'll update teuthology to not install cliff-tablib and throw with a message pointing to this bug recommending a) to add a comment so you get a sense of how often (hopefully never) it happens, b) uninstall cliff-tablib. With luck this bug can be closed in a few months because the problem is so rare that nobody complains.
Thanks for investigating the problem :-)
Steve Martinelli (stevemar) wrote : | #29 |
Circling back to this one, we managed to talk to the author of cliff-tablib and he released a new version (2.0.0: https:/
Loic Dachary (dachary) wrote : | #30 |
Thanks for the update !
Steve Martinelli (stevemar) wrote : | #31 |
So I think we're good on this one. All new OSC installs should be pulling in a new cliff and no longer depending on cliff-tablib. Marking this as Fix Released, let me know if this is still an issue!
Changed in python-openstackclient: | |
status: | Incomplete → Fix Released |
Loic Dachary (dachary) wrote : | #32 |
Absolutely :-) Thanks for following up !
as of 1.8.0 we no longer install cliff-tablib (https:/ /github. com/openstack/ python- openstackclient /commit/ b60a9492a31bb11 30338176e4b90a7 572c10edc3)
it seems unmaintained and any functionality we were using has been moved to cliff (https:/ /github. com/openstack/ cliff/commit/ 4e1470d93e101d1 390b39b93dec569 c7c8966b83)
i think the right move here is to bump the requirements to 1.15.0 so we are definitely using the bits from cliff and not cliff-tablib