import teuthology
from . import orchestra
import orchestra.remote
-from .openstack import OpenStack, OpenStackInstance
+from .openstack import OpenStack, OpenStackInstance, enforce_json_dictionary
from .orchestra import run
from .config import config, FakeNamespace
from .lock import list_locks
log.debug("stale-openstack: {id} disappeared, ignored"
.format(id=volume['ID']))
continue
- volume = dict(map(lambda v: (v['Field'], v['Value']), volume))
+ enforce_json_dictionary(volume)
created_at = datetime.datetime.strptime(
volume['created_at'], '%Y-%m-%dT%H:%M:%S.%f')
created = (now - created_at).total_seconds()
# A volume created a second ago is left untouched
#
volume_show = (
- '['
- ' {"Field": "id", "Value": "' + id + '"},'
- ' {"Field": "created_at", "Value": "' + now + '"},'
- ' {"Field": "display_name", "Value": "' + name + '"}'
- ']'
+ '{"id": "' + id + '", '
+ '"created_at": "' + now + '", '
+ '"display_name": "' + name + '"}'
)
+
def sh(cmd):
if 'volume show' in cmd:
return volume_show
#
ancient = "2000-11-02T15:43:12.000000"
volume_show = (
- '['
- ' {"Field": "id", "Value": "' + id + '"},'
- ' {"Field": "created_at", "Value": "' + ancient + '"},'
- ' {"Field": "display_name", "Value": "' + name + '"}'
- ']'
+ '{"id": "' + id + '", '
+ '"created_at": "' + ancient + '", '
+ '"display_name": "' + name + '"}'
)
+
def sh(cmd):
if 'volume show' in cmd:
return volume_show
nuke.stale_openstack_nodes(ctx, {
uuid: {
'ID': uuid,
- 'Name': name,
+ 'Name': name,
},
}, {
name: { 'locked_since': ancient,