binbeobo / google-cloud-sdk

Automatically exported from code.google.com/p/google-cloud-sdk
0 stars 1 forks source link

gcloud compute listing custom machine instances errors #399

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Issue running command [gcloud compute instances list].

What steps will reproduce the problem?
Create an instance with a custom CPU and MEMORY, then try and list the 
instances with gcloud.

What is the expected output? What do you see instead?
I expect to see a list of instances. I get an error: 
ERROR: gcloud crashed (ValueError): zero length field name in format

Please provide any additional information below.

Traceback (most recent call last):
  File "calliope/cli.py", line 609, in Execute
    result = args.cmd_func(cli=self, args=args)
  File "calliope/backend.py", line 1229, in Run
    display.Displayer(command_instance, args, resources).Display()
  File "calliope/display.py", line 356, in Display
    self._command.Display(self._args, self._resources)
  File "api_lib/compute/base_classes.py", line 308, in Display
    PrintTable(resources, self._resource_spec.table_cols)
  File "api_lib/compute/base_classes.py", line 57, in PrintTable
    row.append(action(resource))
  File "api_lib/compute/resource_specs.py", line 160, in _MachineTypeNameToCell
    return _FormatCustomMachineTypeName(mt)
  File "api_lib/compute/resource_specs.py", line 129, in _FormatCustomMachineTypeName
    custom_ram_gb = '{:.2f}'.format(float(custom_ram) / (2 ** 10))
ValueError: zero length field name in format

Installation information:

Google Cloud SDK [0.9.87]

Platform: [Linux, x86_64]
Python Version: [2.6.6 (r266:84292, Jul 23 2015, 15:22:56)  [GCC 4.4.7 20120313 
(Red Hat 4.4.7-11)]]
Python Location: [/usr/bin/python2]
Site Packages: [Disabled]

Installation Root: [/milk/users/dave/google-cloud-sdk]
Installed Components:
  core: [2015.11.18]
  core-nix: [2015.11.16]
  gcloud: []
  gsutil-nix: [4.15]
  gsutil: [4.15]
  bq: [2.0.18]
  bq-nix: [2.0.18]
[output truncated]

Original issue reported on code.google.com by d...@milk-vfx.com on 23 Nov 2015 at 6:06

GoogleCodeExporter commented 8 years ago
Thanks for reporting this! It looks as though it's due to an incompatibility 
with Python 2.6 (the Cloud SDK requires Python 2.7, as stated on 
<https://cloud.google.com/sdk/>).

For now, you should be able to use the `--format=json` flag if you need to see 
the details, or use Python 2.7.

We'll try to get this fixed up soon.

Original comment by z...@google.com on 23 Nov 2015 at 6:11

GoogleCodeExporter commented 8 years ago
As it turns out, we've already fixed this on our end. It should work starting 
in Cloud SDK version 0.9.88, which should be released later this week.

Original comment by z...@google.com on 23 Nov 2015 at 6:20

GoogleCodeExporter commented 8 years ago
I've installed Python2.7 but in a different directory, can I set the path
in gcloud somewhere so it uses it?

Dave.

Original comment by d...@milk-vfx.com on 24 Nov 2015 at 1:27

GoogleCodeExporter commented 8 years ago
Ahh, sorry about that.

You can set the environment variable CLOUDSDK_PYTHON to "/path/to/python2.7".

(Shortly, any mismatched Python version will result in a warning suggesting 
this.)

Original comment by z...@google.com on 24 Nov 2015 at 3:06

GoogleCodeExporter commented 8 years ago
Ah, I've tried that and I now get this error

Traceback (most recent call last):
  File
"/milk/users/dave/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py",
line 86, in <module>
    from googlecloudsdk.calliope import base
  File
"/milk/users/dave/google-cloud-sdk/./lib/googlecloudsdk/calliope/base.py",
line 8, in <module>
    from googlecloudsdk.calliope import usage_text
  File
"/milk/users/dave/google-cloud-sdk/./lib/googlecloudsdk/calliope/usage_text.py",
line 12, in <module>
    from googlecloudsdk.calliope import arg_parsers
  File
"/milk/users/dave/google-cloud-sdk/./lib/googlecloudsdk/calliope/arg_parsers.py"
,
line 43, in <module>
    from googlecloudsdk.core import log
  File
"/milk/users/dave/google-cloud-sdk/./lib/googlecloudsdk/core/log.py", line
12, in <module>
    from googlecloudsdk.core import properties
  File
"/milk/users/dave/google-cloud-sdk/./lib/googlecloudsdk/core/properties.py",
line 13, in <module>
    from googlecloudsdk.core.credentials import devshell as c_devshell
  File
"/milk/users/dave/google-cloud-sdk/./lib/googlecloudsdk/core/credentials/devshel
l.py",
line 10, in <module>
    from oauth2client import client
  File "/milk/users/dave/google-cloud-sdk/./lib/oauth2client/client.py",
line 37, in <module>
    import httplib2
  File "/milk/users/dave/google-cloud-sdk/./lib/httplib2/__init__.py", line
930, in <module>
    class HTTPSConnectionWithTimeout(httplib.HTTPSConnection):
AttributeError: 'module' object has no attribute 'HTTPSConnection'

Original comment by d...@milk-vfx.com on 24 Nov 2015 at 3:11

GoogleCodeExporter commented 8 years ago
I'm also using python 2.7.10

Original comment by d...@milk-vfx.com on 24 Nov 2015 at 3:17

GoogleCodeExporter commented 8 years ago
Odd. That points to your CLOUDSDK_PYTHON having trouble with its standard 
library (httplib is a built-in Python module, and HTTPSConnection is present in 
2.6 and 2.7.

Can you run:

   $CLOUDSDK_PYTHON -Sc 'import httplib; httplib.HTTPSConnection' && echo success

It should print 'success'. If this is the case, there's something amiss with 
the way the Cloud SDK is loading your Python. Troubleshooting this would be 
easiest if you gave an easy reproduction (i.e. letting us know the exact OS 
version, how you installed Python 2.7, etc.).

If not, we're dealing with a busted Python 2.7 installation or configuration, 
and it'll be hard to get very far.

It might be easier just to wait; 0.9.88 will be released in a few hours, 
barring unforeseen circumstances.

Original comment by z...@google.com on 24 Nov 2015 at 3:29

GoogleCodeExporter commented 8 years ago
Ah ok, as I get this:

dave $ $CLOUDSDK_PYTHON -Sc 'import httplib; httplib.HTTPSConnection' &&
echo success
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: 'module' object has no attribute 'HTTPSConnection'

----------------------------------------------------
*Dave Goodbourn*
Head of Systems
*MILK <http://www.milk-vfx.com/> VISUAL EFFECTS*

5th floor, Threeways House,
40-44 Clipstone Street London, W1W 5DW
Tel: *+44 (0)20 3697 8448*
Mob: *+44 (0)7917 411 069*

Original comment by d...@milk-vfx.com on 24 Nov 2015 at 3:31

GoogleCodeExporter commented 8 years ago
0.9.88 is out. Please let us know if you can still reproduce this issue.

Original comment by z...@google.com on 24 Nov 2015 at 9:28

GoogleCodeExporter commented 8 years ago
Ah, great, that fixed it.

I do get another warning but it doesn't stop it working at all and I was
getting this before:

/milk/users/dave/google-cloud-sdk/lib/googlecloudsdk/api_lib/compute/base_classe
s.py:7:
DeprecationWarning: the sets module is deprecated

Original comment by d...@milk-vfx.com on 25 Nov 2015 at 10:03

GoogleCodeExporter commented 8 years ago
Glad it's working for you now.

I've added an item to get rid of the use of the sets module to our work queue 
(though it's relatively low-priority)--it's an artifact of some very old code. 
That message doesn't print in 2.7.

Original comment by z...@google.com on 25 Nov 2015 at 4:00