Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

terminus sites create API call crashes with a Python backtrace #1102

Open
ossobuffo opened this issue Jun 7, 2016 · 4 comments
Open

terminus sites create API call crashes with a Python backtrace #1102

ossobuffo opened this issue Jun 7, 2016 · 4 comments
Assignees

Comments

@ossobuffo
Copy link

terminus sites create --org=my-org --site=provisioning-test \
  --label="Provisioning Test" --upstream=21e1fada-199c-492b-97bd-0b36b53a9da0

results in the an error. Upon further investigation, the following backtrace is given in the HTTP response:

Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/twisted/python/context.py", line 81, in callWithContext
    return func(*args,**kw)
  File "/usr/lib/python2.7/site-packages/titan/yggdrasil/models/tasks.py", line 290, in run
    **self.metadata.get('params')
  File "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py", line 134, in maybeDeferred
    result = f(*args, **kw)
  File "/usr/lib/python2.7/site-packages/titan/yggdrasil/yggdrasil_tasks.py", line 4064, in trigger_task
    **params
--- <exception caught here> ---
  File "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py", line 134, in maybeDeferred
    result = f(*args, **kw)
  File "/usr/lib/python2.7/site-packages/titan/yggdrasil/yggdrasil_tasks.py", line 1819, in create_site
    membership = memberships.YggdrasilUserOrganizationMemberships(bucket=user_id).retrieve(organization_id)
  File "/usr/lib/python2.7/site-packages/titan/backends/cassandra/collection.py", line 1025, in retrieve
    normalized_id = self.normalize_id(model_id)
  File "/usr/lib/python2.7/site-packages/titan/yggdrasil/models/memberships.py", line 552, in normalize_id
    return uuid.UUID(str(model_id))
  File "/usr/lib64/python2.7/uuid.py", line 134, in __init__
    raise ValueError('badly formed hexadecimal UUID string')
exceptions.ValueError: badly formed hexadecimal UUID string

It turns out that the following JSON payload is being sent:

{
  "type":"create_site",
  "params":{
    "label":"Provisioning Test",
    "site_name":"provisioning-test",
    "organization_id":"my-org",
    "deploy_product":{
      "product_id":"21e1fada-199c-492b-97bd-0b36b53a9da0"
    }
  }
}

The call succeeds if the organization_id is sent as a UUID instead of the org name.

@ossobuffo
Copy link
Author

Obviously, if you pass the org's UUID in the --org parameter the command works... but passing a non-UUID shouldn't cause a catastrophic crash. At the very least, a warning message to the user would be nice; a name-based lookup (or even a menu-choice) would be icing on the cake.

@TeslaDethray
Copy link
Contributor

TeslaDethray commented Jun 7, 2016

It looks like there's an issue when looking up your organization's ID. I can't duplicate this error exactly - I can make it err without telling me my organization name is bad, but it won't give me a Python stacktrace. Would it be possible to get the --debug output from when you try to run this please, @ossobuffo? You can email it to sara [at] pantheon.io to keep the session JWT/UUIDs from public view.

@TeslaDethray TeslaDethray self-assigned this Jun 7, 2016
@ossobuffo
Copy link
Author

I emailed you the debug output, but now the error is happening during a GET to workflows rather than on the POST, and I doubt it's the same Python error. I haven't examined the curl output of the GET query.

I do know that I have had trouble yesterday and today with validating workflow-related tasks. In some cases Terminus was trapped in a perpetual loop of GETs on workflows even though the workflow with the appropriate ID had a result value of succeeded.

I did happen to capture a trace URL from yesterday's POST error:

https://logs.getpantheon.com:443//#/dashboard/file/Trace_Id.json?trace_id=a3018db0-2c2c-11e6-b7fa-133239051faa&from_iso_date=2016-06-06T21:16:30.659766Z&to_iso_date=2016-06-06T21:26:33.090551Z

No idea if this will help.

@dustinleblanc
Copy link
Contributor

As of Today 0.13.1 is failing on site creates by not providing the site_name:

[2016-10-01 13:41:13] [info] Creating new site ...
[2016-10-01 13:41:13] [debug] #### REQUEST ####
Params: {"headers":{"User-Agent":"Terminus\/0.13.1 (php_version=7.0.11&script=boot-fs.php)","Content-type":"application\/json","Authorization":"Bearer not you"},"verify":true,"method":"post","absolute_url":false,"json":{"type":"create_site","params":{"label":"Happy Hackr","site_name":""}}}
URI: https://terminus.pantheon.io:443/api/users/my_UUID/workflows
Method: post
    params: '{"headers":{"User-Agent":"Terminus\/0.13.1 (php_version=7.0.11&script=boot-fs.php)","Content-type":"application\/json","Authorization":"not you"},"verify":true,"method":"post","absolute_url":false,"json":{"type":"create_site","params":{"label":"Happy Hackr","site_name":""}}}'
    uri: 'https://terminus.pantheon.io:443/api/users/0f9fd787-17cf-4143-8daa-3d4ed840ca8b/workflows'
    method: 'post'

[2016-10-01 13:41:13] [error] The domain "" is invalid. The site name can only contain a-z, A-Z, 0-9, and dashes ('-'), cannot begin or end with a dash, and must be fewer than 52 characters
 dustinleblanc  ~ 

If I get enough free time this weekend I'll see if I can fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants