4 ## Copyright (c) 2010-2020 Intel Corporation
6 ## Licensed under the Apache License, Version 2.0 (the "License");
7 ## you may not use this file except in compliance with the License.
8 ## You may obtain a copy of the License at
10 ## http://www.apache.org/licenses/LICENSE-2.0
12 ## Unless required by applicable law or agreed to in writing, software
13 ## distributed under the License is distributed on an "AS IS" BASIS,
14 ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 ## See the License for the specific language governing permissions and
16 ## limitations under the License.
18 from rapid_log import RapidLog
19 from stackdeployment import StackDeployment
24 import ConfigParser as configparser
26 class RapidStackManager(object):
28 def parse_config(rapid_stack_params):
29 config = configparser.RawConfigParser()
30 config.read('config_file')
32 options = config.options(section)
33 for option in options:
34 rapid_stack_params[option] = config.get(section, option)
35 return (rapid_stack_params)
38 def deploy_stack(rapid_stack_params):
39 cloud_name = rapid_stack_params['cloud_name']
40 stack_name = rapid_stack_params['stack_name']
41 heat_template = rapid_stack_params['heat_template']
42 heat_param = rapid_stack_params['heat_param']
43 keypair_name = rapid_stack_params['keypair_name']
44 user = rapid_stack_params['user']
45 deployment = StackDeployment(cloud_name)
46 deployment.deploy(stack_name, keypair_name, heat_template, heat_param)
47 deployment.generate_env_file(user)
50 rapid_stack_params = {}
51 RapidStackManager.parse_config(rapid_stack_params)
52 log_file = 'CREATE{}.log'.format(rapid_stack_params['stack_name'])
53 RapidLog.log_init(log_file, 'DEBUG', 'INFO', '2020.09.23')
54 #cloud_name = 'openstackL6'
56 #heat_template = 'openstack-rapid.yaml'
57 #heat_param = 'params_rapid.yaml'
58 #keypair_name = 'prox_key'
60 RapidStackManager.deploy_stack(rapid_stack_params)
62 if __name__ == "__main__":