Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions keystone/preload.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@

# (C) Copyright 2015-2017 Hewlett-Packard Enterprise Development LP
# Copyright 2015 FUJITSU LIMITED
#
# 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.

from __future__ import print_function

Expand All @@ -13,9 +25,9 @@

import yaml

from keystoneauth1 import session as ks_session
from keystoneauth1.exceptions.connection import ConnectFailure
from keystoneauth1.identity import v3
from keystoneauth1 import session as ks_session
from keystoneclient.v3 import client


Expand Down Expand Up @@ -147,7 +159,8 @@ def add_user_roles(ks_client, users):
def add_service_endpoint(ks_client, name, description, endpoint_type,
url, region, interface):
"""Add the Monasca service to the catalog with the specified endpoint,
if it doesn't yet exist."""
if it doesn't yet exist.
"""
services = _retry(lambda: ks_client.services.list())
service_names = {service.name: service for service in services}
if name in service_names.keys():
Expand Down Expand Up @@ -201,7 +214,8 @@ def resolve_k8s_service_by_url(url):

def main(argv):
"""Get credentials to create a keystoneauth Session to instantiate a
Keystone Client and then call methods to add users, projects and roles"""
Keystone Client and then call methods to add users, projects and roles
"""

path = os.environ.get('PRELOAD_YAML_PATH', '/preload.yml')
try:
Expand Down
3 changes: 2 additions & 1 deletion monasca-agent-base/kubernetes_get_host.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# (C) Copyright 2017 Hewlett Packard Enterprise Development LP
# coding=utf-8

from monasca_agent.collector.checks import utils

kubernetes_connector = utils.KubernetesConnector(3)
print kubernetes_connector.get_agent_pod_host(return_host_name=True)
print(kubernetes_connector.get_agent_pod_host(return_host_name=True))
2 changes: 2 additions & 0 deletions monasca-agent-base/template.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python
# coding=utf-8

# (C) Copyright 2017 Hewlett Packard Enterprise Development LP
#
Expand Down Expand Up @@ -36,5 +37,6 @@ def main():
trim_blocks=True)
out_file.write(t.render(os.environ))


if __name__ == '__main__':
main()