3 # Copyright 2017 Red Hat, Inc.
5 # Licensed under the Apache License, Version 2.0 (the "License"); you may
6 # not use this file except in compliance with the License. You may obtain
7 # a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 # License for the specific language governing permissions and limitations
23 from tripleo_common.utils import roles as rolesutils
25 __tht_root_dir = os.path.dirname(os.path.dirname(__file__))
26 __tht_roles_dir = os.path.join(__tht_root_dir, 'roles')
30 parser = argparse.ArgumentParser(
31 description='Generate roles_data.yaml for requested roles. NOTE: '
32 'This is a stripped down version of what is provided by '
33 'the tripleoclient. The tripleoclient should be used for '
34 'additional functionality.')
35 parser.add_argument('--roles-path', metavar='<roles directory>',
36 help="Filesystem path containing the roles yaml files",
37 default=__tht_roles_dir)
38 parser.add_argument('roles', nargs="+", metavar='<role>',
39 help='List of roles to use to generate the '
40 'roles_data.yaml file')
41 opts = parser.parse_args(argv[1:])
45 opts = parse_opts(sys.argv)
47 roles = collections.OrderedDict.fromkeys(opts.roles)
48 print(rolesutils.generate_roles_data_from_directory(opts.roles_path,