26a3d7e6d0
This change fixes few linting errors which are discovered by newer linters. - bashate: consistent 4 chars identation - python unamed Exceptions - python space around operators - python space after # comments - python unused imports - python unknown escapes (errors after py36) - python double newline before methods Change-Id: I5d2f37d1c820b1983355be60c09de581a72e08e0 Needed-By: https://review.opendev.org/#/c/665445/
58 lines
1.7 KiB
Python
Executable File
58 lines
1.7 KiB
Python
Executable File
#!/usr/bin/python
|
|
# Copyright 2016 Red Hat, Inc.
|
|
# All Rights Reserved.
|
|
#
|
|
# 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 argparse
|
|
import logging
|
|
import os
|
|
import sys
|
|
|
|
import os_client_config
|
|
from tripleo_common.utils import config
|
|
|
|
|
|
def get_orchestration_client():
|
|
return os_client_config.make_client('orchestration')
|
|
|
|
|
|
def get_args():
|
|
parser = argparse.ArgumentParser(
|
|
description=("tripleo-config-download"),
|
|
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
|
parser.add_argument('--stack-name', '-s',
|
|
default='overcloud',
|
|
help="Heat stack name")
|
|
parser.add_argument('--output-dir', '-o',
|
|
default='tripleo-config-download',
|
|
help="Output directory for downloaded config")
|
|
|
|
args = parser.parse_args(sys.argv[1:])
|
|
return args
|
|
|
|
|
|
if __name__ == '__main__':
|
|
args = get_args()
|
|
|
|
logging.basicConfig()
|
|
log = logging.getLogger()
|
|
log.setLevel(logging.INFO)
|
|
|
|
if not os.path.exists(args.output_dir):
|
|
os.mkdir(args.output_dir)
|
|
|
|
client = get_orchestration_client()
|
|
stack_config = config.Config(client)
|
|
stack_config.download_config(args.stack_name, args.output_dir)
|