def stale_openstack_nodes(ctx, instances, locked_nodes): names = set([i['Name'] for i in instances.values()]) for (name, node) in locked_nodes.items(): name = decanonicalize_hostname(name) if node['machine_type'] != 'openstack': continue if (name not in names and locked_since_seconds(node) > OPENSTACK_DELAY): log.info("stale-openstack: unlocking node {name} unlocked" " because it was created {created}" " seconds ago which is older than {delay}" " and it has no instance".format( name=name, created=locked_since_seconds(node), delay=OPENSTACK_DELAY)) if not ctx.dry_run: unlock_one(ctx, name, node['locked_by']) continue log.debug("stale-openstack: node " + name + " OK")
def stale_openstack_nodes(ctx, instances, locked_nodes): names = set([ i['Name'] for i in instances.values() ]) for (name, node) in locked_nodes.iteritems(): name = decanonicalize_hostname(name) if node['machine_type'] != 'openstack': continue if (name not in names and locked_since_seconds(node) > OPENSTACK_DELAY): log.info("stale-openstack: unlocking node {name} unlocked" " because it was created {created}" " seconds ago which is older than {delay}" " and it has no instance" .format(name=name, created=locked_since_seconds(node), delay=OPENSTACK_DELAY)) if not ctx.dry_run: unlock_one(ctx, name, node['locked_by']) continue log.debug("stale-openstack: node " + name + " OK")