buildbot / buildbot/buildbot

OpenStackLatentWorker does not interpolate parameters

Open
#5,113 0 comments 0 reactions 0 assignees View on GitHub
feature
Dominant language
Python
Stars
5.5k
Forks
1.7k
Avg merge
2d 7h
Merged PRs (30d)
6

Description

Buildbot version: 2.5.0

With following snippet
```.py
c['workers'].append(worker.OpenStackLatentWorker('openstack-worker-01', 'slavepass',
image = util.Interpolate('%(prop:os_image_uuid)s'),
flavor = util.Interpolate('%(prop:os_image_flavor)s'),
missing_timeout = 600
))
```

And with scheduler

```.py
c['schedulers'].append(schedulers.ForceScheduler(
name="test-ci",
buttonName="Run",
label="Run test CI",
builderNames=["test-ci"],
properties=[
util.FixedParameter(name="os_image_uuid", default="b9c6f993-6b4a-44a0-accf-c5c3e1536a88"),
util.FixedParameter(name="os_image_flavor", default="c931aa9d-7c81-4dfe-9c2a-4912b161ba1d")
],
codebases=[util.CodebaseParameter(codebase='', repository='', revision='', branch='', hide=True)],
reason=util.FixedParameter(name="reason", default="Forced build"),
username=util.FixedParameter(name="username", default="user"),
))
```

We get following error in buildbot

```
Traceback (most recent call last):
File "/opt/buildbot/lib/python3.5/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks
current.result = callback(current.result, *args, **kw)
File "/opt/buildbot/lib/python3.5/site-packages/twisted/internet/defer.py", line 1475, in gotResult
_inlineCallbacks(r, g, status)
File "/opt/buildbot/lib/python3.5/site-packages/twisted/internet/defer.py", line 1416, in _inlineCallbacks
result = result.throwExceptionIntoGenerator(g)
File "/opt/buildbot/lib/python3.5/site-packages/twisted/python/failure.py", line 491, in throwExceptionIntoGenerator
return g.throw(self.type, self.value, self.tb)
--- ---
File "/opt/buildbot/lib/python3.5/site-packages/buildbot/process/build.py", line 346, in startBuild
ready_or_failure = yield workerforbuilder.prepare(self)
File "/opt/buildbot/lib/python3.5/site-packages/buildbot/worker/latent.py", line 265, in _substantiate
start_success = yield self.start_instance(build)
File "/opt/buildbot/lib/python3.5/site-packages/twisted/internet/defer.py", line 1416, in _inlineCallbacks
result = result.throwExceptionIntoGenerator(g)
File "/opt/buildbot/lib/python3.5/site-packages/twisted/python/failure.py", line 491, in throwExceptionIntoGenerator
return g.throw(self.type, self.value, self.tb)
File "/opt/buildbot/lib/python3.5/site-packages/buildbot/worker/openstack.py", line 218, in start_instance
block_devices)
File "/opt/buildbot/lib/python3.5/site-packages/twisted/python/threadpool.py", line 250, in inContext
result = inContext.theWork()
File "/opt/buildbot/lib/python3.5/site-packages/twisted/python/threadpool.py", line 266, in
inContext.theWork = lambda: context.call(ctx, func, *args, **kw)
File "/opt/buildbot/lib/python3.5/site-packages/twisted/python/context.py", line 122, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "/opt/buildbot/lib/python3.5/site-packages/twisted/python/context.py", line 85, in callWithContext
return func(*args,**kw)
File "/opt/buildbot/lib/python3.5/site-packages/buildbot/worker/openstack.py", line 227, in _start_instance
instance = self.novaclient.servers.create(*boot_args, **boot_kwargs)
File "/opt/buildbot/lib/python3.5/site-packages/novaclient/v2/servers.py", line 1434, in create
return self._boot(response_key, *boot_args, **boot_kwargs)
File "/opt/buildbot/lib/python3.5/site-packages/novaclient/v2/servers.py", line 828, in _boot
return_raw=return_raw, **kwargs)
File "/opt/buildbot/lib/python3.5/site-packages/novaclient/base.py", line 364, in _create
resp, body = self.api.client.post(url, body=body)
File "/opt/buildbot/lib/python3.5/site-packages/keystoneauth1/adapter.py", line 381, in post
return self.request(url, 'POST', **kwargs)
File "/opt/buildbot/lib/python3.5/site-packages/novaclient/client.py", line 78, in request
raise exceptions.from_response(resp, body, url, method)
novaclient.exceptions.BadRequest: Flavor Interpolate('%(prop:os_image_flavor)s') could not be found. (HTTP 400) (Request-ID: req-4eb9d628-e886-45ae-b9f2-2d0d62dbb0ab)
```

So the flavor parameter, ~~and probably image too~~ (update: image works just fine), are not being actually interpolated but somehow force-mangled into strings causing really unexpected behaviour.

Also the HTTP 400 error causes RETRY when it should probably not.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.