cb4e875ae1
The majority of the start.sh code is identical. This removes that duplicate code while still maintaining the ability to call code in a specific container. The start.sh is moved into /usr/local/bin/kolla_start in the container The extend_start.sh script is called by the kolla_start script at the location /usr/local/bin/kolla_extend_start . It always exists because we create a noop kolla_extend_start in the base directory. We override it with extend_start.sh in a specific image should we need to. Of note, the neutron-agents container is exempt from this new structure due to it being a fat container. Additionally, we fix the inconsistent permissions throughout. 644 for repo files and the scripts are set to 755 via a Docker RUN command to ensure someones local perm change won't break upstream containers. Change-Id: I7da8d19965463ad30ee522a71183e3f092e0d6ad Closes-Bug: #1501295
68 lines
2.1 KiB
Python
68 lines
2.1 KiB
Python
#!/usr/bin/python
|
|
|
|
# Copyright 2015 Sam Yaple
|
|
#
|
|
# 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.
|
|
|
|
# This is a stripped down version of an ansible module I wrote in Yaodu to
|
|
# achieve the same goals we have for Kolla. I have relicensed it for Kolla
|
|
# https://github.com/SamYaple/yaodu/blob/master/ansible/library/bslurp
|
|
|
|
# Basically this module will fetch the admin and mon keyrings as well as the
|
|
# monmap file. It then hashes the content, compresses them, and finally it
|
|
# converts them to base64 to be safely transported around with ansible
|
|
|
|
import base64
|
|
import hashlib
|
|
import json
|
|
import os
|
|
import sys
|
|
import zlib
|
|
|
|
|
|
def json_exit(msg=None, failed=False, changed=False):
|
|
if type(msg) is not dict:
|
|
msg = {'msg': str(msg)}
|
|
msg.update({'failed': failed, 'changed': changed})
|
|
print(json.dumps(msg))
|
|
sys.exit()
|
|
|
|
|
|
def read_file(filename):
|
|
filename_path = os.path.join('/etc/ceph', filename)
|
|
|
|
if not os.path.exists(filename_path):
|
|
json_exit("file not found: {}".format(filename_path), failed=True)
|
|
if not os.access(filename_path, os.R_OK):
|
|
json_exit("file not readable: {}".format(filename_path), failed=True)
|
|
|
|
with open(filename_path, 'rb') as f:
|
|
raw_data = f.read()
|
|
|
|
return {'content': base64.b64encode(zlib.compress(raw_data)),
|
|
'sha1': hashlib.sha1(raw_data).hexdigest(),
|
|
'filename': filename}
|
|
|
|
|
|
def main():
|
|
admin_keyring = 'ceph.client.admin.keyring'
|
|
mon_keyring = 'ceph.client.mon.keyring'
|
|
monmap = 'ceph.monmap'
|
|
|
|
files = [admin_keyring, mon_keyring, monmap]
|
|
json_exit({filename: read_file(filename) for filename in files})
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|