Source code for heat.common.service_utils
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import uuid
from oslo_utils import timeutils
from heat.rpc import listener_client
SERVICE_KEYS = (
    SERVICE_ID,
    SERVICE_HOST,
    SERVICE_HOSTNAME,
    SERVICE_BINARY,
    SERVICE_TOPIC,
    SERVICE_ENGINE_ID,
    SERVICE_REPORT_INTERVAL,
    SERVICE_CREATED_AT,
    SERVICE_UPDATED_AT,
    SERVICE_DELETED_AT,
    SERVICE_STATUS
) = (
    'id',
    'host',
    'hostname',
    'binary',
    'topic',
    'engine_id',
    'report_interval',
    'created_at',
    'updated_at',
    'deleted_at',
    'status'
)
[docs]
def engine_alive(context, engine_id):
    return listener_client.EngineListenerClient(
        engine_id).is_alive(context) 
[docs]
def generate_engine_id():
    return str(uuid.uuid4())