File: main.py

package info (click to toggle)
python-tempestconf 3.5.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 964 kB
  • sloc: python: 4,530; makefile: 18; sh: 9
file content (643 lines) | stat: -rwxr-xr-x 28,410 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
# Copyright 2016, 2018 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.
"""
This script will generate the etc/tempest.conf file by applying a series of
specified options in the following order:

1. Default values provided by the tool.

2. Values using the file provided by the --deployer-input argument to the
script.
Some required options differ among deployed clouds but the right values cannot
be discovered by the user. The file used here could be created by an installer,
or manually if necessary.

3. Values provided in client's cloud config file or as an environment
variables, see documentation of openstacksdk
https://docs.openstack.org/openstacksdk/latest/

4. Values provided on the command line. These override all other values.

5. Discovery. Values that have not been provided in steps [2-4] will be
obtained by querying the cloud.
"""

import argparse
import logging
import os
import sys

import openstack
from oslo_config import cfg
from six.moves import configparser

from config_tempest import accounts
from config_tempest.clients import ClientManager
from config_tempest import constants as C
from config_tempest.constants import LOG
from config_tempest.credentials import Credentials
from config_tempest.flavors import Flavors
from config_tempest import profile
from config_tempest.services.services import Services
from config_tempest.tempest_conf import TempestConf
from config_tempest.users import Users


def set_logging(debug, verbose):
    """Set logging based on the arguments.

    :type debug: Boolean
    :type verbose: Boolean
    """
    log_format = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
    logging.basicConfig(format=log_format)
    if debug:
        LOG.setLevel(logging.DEBUG)
    elif verbose:
        LOG.setLevel(logging.INFO)


def load_basic_defaults(conf):
    """Load basic default options into conf file.

    :type conf: TempestConf object
    """
    LOG.debug("Setting basic default values")
    default_values = {
        "DEFAULT": [
            ("debug", "true"),
            ("use_stderr", "false"),
            ("log_file", "tempest.log")
        ],
        "identity": [
            ("username", "demo_tempestconf"),
            ("password", "secrete"),
            ("project_name", "demo"),
            ("project_domain_name", "Default"),
            ("user_domain_name", "Default"),
            ("alt_username", "alt_demo_tempestconf"),
            ("alt_password", "secrete"),
            ("alt_project_name", "alt_demo")
        ],
        "auth": [
            ("tempest_roles", "member"),
            ("admin_username", "admin"),
            ("admin_project_name", "admin"),
            ("admin_domain_name", "Default"),
            ("admin_project_domain_name", "Default"),
            ("admin_user_domain_name", "Default")
        ],
        "object-storage": [
            ("reseller_admin_role", "ResellerAdmin")
        ],
        "oslo-concurrency": [
            ("lock_path", "/tmp")
        ],
        "compute-feature-enabled": [
            ("preserve_ports", "true")
        ],
        "network-feature-enabled": [
            ("ipv6_subnet_attributes", "true")
        ],
        "scenario": [
            # Since cirros version 0.6.0, dhcpcd dhcp client is the default
            # and because tempestconf sets default cirros >= 0.6.0 by default,
            # we can also set the dhcp client to dhcpcd by default
            ("dhcp_client", "dhcpcd")
        ]}

    for section in default_values.keys():
        if section != "DEFAULT" and not conf.has_section(section):
            conf.add_section(section)
        for key, value in default_values[section]:
            if not conf.has_option(section, key):
                conf.set(section, key, value)


def read_deployer_input(deployer_input_file, conf):
    """Read deployer-input file and set values in conf accordingly.

    :param deployer_input_file: Path to the deployer inut file
    :type deployer_input_file: String
    :param conf: TempestConf object
    """
    LOG.info("Adding options from deployer-input file '%s'",
             deployer_input_file)
    deployer_input = configparser.ConfigParser()
    # the following transforms the option names as found in an input file,
    # the default implementation returns a lower-case version of the
    # option names, however, we have at least one option that contains
    # capitalized letters - RBAC_test_type from octavia-tempest-plugin
    deployer_input.optionxform = str
    deployer_input.read(deployer_input_file)
    for section in deployer_input.sections():
        # There are no deployer input options in DEFAULT
        for (key, value) in deployer_input.items(section):
            conf.set(section, key, value, priority=True)


def set_options(conf, deployer_input, non_admin, image_path, overrides=[],
                accounts_path=None, cloud_creds=None,
                no_default_deployer=False):
    """Set options in conf provided by different source.

    1. read the default values
    2. read a file provided by --deployer-input argument
    3. read default DEPLOYER_INPUT if --no-deployer-input is False and no
       deployer_input was passed
    4. set values from client's config (openstacksdk support) if provided
    5. set overrides - may override values which were set in the steps above

    :param conf: TempestConf object
    :param deployer_input: Path to the deployer inut file
    :type deployer_input: string
    :type non_admin: boolean
    :param image_path: An image to be uploaded to glance
    :type image_path: string
    :param overrides: list of tuples: [(section, key, value)]
    :type overrides: list
    :param accounts_path: A path where accounts.yaml is or will be created.
    :type accounts_path: string
    :param cloud_creds: Cloud credentials from client's config
    :type cloud_creds: dict
    """
    load_basic_defaults(conf)
    # image.image_path is a python-tempestconf option which defines which
    # image will be uploaded to glance
    conf.set('image', 'image_path', image_path)

    if deployer_input and os.path.isfile(deployer_input):
        LOG.info("Reading deployer input from file %s", deployer_input)
        read_deployer_input(deployer_input, conf)
    elif os.path.isfile(C.DEPLOYER_INPUT) and not no_default_deployer:
        LOG.info("Reading deployer input from file %s", C.DEPLOYER_INPUT)
        read_deployer_input(C.DEPLOYER_INPUT, conf)

    if non_admin:
        # non admin, so delete auth admin values which were set
        # in load_basic_defaults method
        conf.set("auth", "admin_username", "")
        conf.set("auth", "admin_project_name", "")
        conf.set("auth", "admin_password", "")
        conf.set("auth", "use_dynamic_credentials", "False", priority=True)

    # get and set auth data from client's config
    if cloud_creds:
        set_cloud_config_values(non_admin, cloud_creds, conf)

    if accounts_path:
        # new way for running using accounts file
        conf.set("auth", "use_dynamic_credentials", "False", priority=True)
        conf.set("auth", "test_accounts_file",
                 os.path.abspath(accounts_path))

    # set overrides - values specified in CLI
    for section, key, value in overrides:
        conf.set(section, key, value, priority=True)

    uri = conf.get("identity", "uri")
    if "v3" in uri:
        conf.set("identity", "uri_v3", uri)
    else:
        # TODO(arxcruz) make a check if v3 is enabled
        conf.set("identity", "uri_v3", uri.replace("v2.0", "v3"))


def get_arg_parser():
    parser = argparse.ArgumentParser(__doc__)
    cloud_config = openstack.config.OpenStackConfig()
    cloud_config.register_argparse_arguments(parser, sys.argv)
    parser.add_argument('--create', action='store_true', default=False,
                        help="""Create Tempest resources
                                Make *python-tempestconf* to create Tempest
                                resources such as flavors needed for running
                                Tempest tests.""")
    parser.add_argument('--out', default="etc/tempest.conf",
                        help="""Output file
                                A name of the file where the discovered Tempest
                                configuration will be written to.""")
    parser.add_argument('--deployer-input', default=None,
                        help="""Path to deployer file
                                A file in the format of tempest.conf that will
                                override the default values. It is usually
                                created by an installer and contains
                                environment specific options.

                                The deployer-input file is an alternative to
                                providing key/value pairs. If there are also
                                key/value pairs they will be applied after the
                                deployer-input file.

                                If the option is **not defined** and
                                **--no-default-deployer** is **not used**,
                                python-tempestconf **will try** to look for the
                                file in `$HOME/tempest-deployer-input.conf`
                                location.""")
    parser.add_argument('--no-default-deployer', action='store_true',
                        default=False,
                        help="""Do not check for the default deployer input in
                                `$HOME/tempest-deployer-input.conf`""")
    parser.add_argument('overrides', nargs='*', default=[],
                        help="""Override options
                                Key value pairs used to hardcode values in
                                `tempest.conf`. The key is a section.key where
                                section is a section header in the conf file.
                                For example:
                                 $ discover-tempest-config \\
                                  identity.username myname \\
                                  identity.password mypass""")
    parser.add_argument('--debug', action='store_true', default=False,
                        help='Print debugging information.')
    parser.add_argument('--verbose', '-v', action='store_true', default=False,
                        help='Print more information about the execution.')
    parser.add_argument('--no-rng', action='store_true', default=False,
                        help="""Create new flavors and upload images without
                                random number generator device.""")
    parser.add_argument('--non-admin', action='store_true', default=False,
                        help="""Simulate non-admin credentials.
                                When True, the credentials are used as
                                non-admin ones. No resources are created.""")
    parser.add_argument('--test-accounts', default=None, metavar='PATH',
                        help="""Tempest accounts.yaml file
                                Defines a path to a Tempest accounts.yaml
                                file.
                                For example:
                                 --test-accounts $HOME/tempest/accounts.yaml
                             """)
    parser.add_argument('--create-accounts-file', default=None,
                        metavar='PATH',
                        help="""Generate Tempest accounts file
                                Minimal accounts file will be created in the
                                specified path.
                                For example:
                                  --create-accounts-file $HOME/accounts.yaml
                             """)
    parser.add_argument('--profile', default=None, metavar='PATH',
                        help="""python-tempestconf's profile.yaml file
                                A file which contains definition of
                                python-tempestconf's arguments.
                                NOTE: If this argument is used, other
                                arguments cannot be defined!""")
    parser.add_argument('--generate-profile', default=None,
                        metavar='PATH',
                        help="""Generate a sample profile.yaml file.
                                A sample profile.yaml will be generated in the
                                specified path. After that python-tempestconf
                                ends.
                                For example:
                                  --generate-profile $HOME/profile.yaml
                             """)
    parser.add_argument('--image-disk-format', default=C.DEFAULT_IMAGE_FORMAT,
                        help="""A format of an image to be uploaded to glance.
                                Default is '%s'""" % C.DEFAULT_IMAGE_FORMAT)
    parser.add_argument('--image', default=C.DEFAULT_IMAGE,
                        help="""An image name/path/url to be uploaded to
                                glance if it's not already there. The name of
                                the image is the leaf name of the path. Default
                                is '%s'""" % C.DEFAULT_IMAGE)
    parser.add_argument('--retry-image', default=False, action='store_true',
                        help="""Allow tempestconf to retry download an image,
                                in case of failure, from these urls: '%s'
                                """ % C.DEFAULT_IMAGES)
    parser.add_argument('--flavor-min-mem', default=C.DEFAULT_FLAVOR_RAM,
                        type=int, help="""Specify minimum memory for new
                        flavours, default is '%s'.""" % C.DEFAULT_FLAVOR_RAM)
    parser.add_argument('--flavor-min-disk', default=C.DEFAULT_FLAVOR_DISK,
                        type=int, help="""Specify minimum disk size for new
                        flavours, default is '%s'.""" % C.DEFAULT_FLAVOR_DISK)
    parser.add_argument('--convert-to-raw', action='store_true', default=False,
                        help="""Convert images to raw format before uploading
                                to glance.""")
    parser.add_argument('--network-id',
                        help="""Specify which network with external
                                connectivity should be used by the tests.""")
    parser.add_argument('--network',
                        help="""Specify which network (id/name) with external
                                connectivity should be used by the tests.""")
    parser.add_argument('--append', action='append', default=[],
                        metavar="SECTION.KEY=VALUE[,VALUE]",
                        help="""Append values to tempest.conf
                                Key value pair to be appended to the
                                configuration file.
                                NOTE: Multiple values are supposed to be
                                divided by a COLON only, WITHOUT spaces.
                                For example:
                                 $ discover-tempest-config \\
                                  --append features.ext=tag[,tag-ext] \\
                                  --append section.ext=ext[,another-ext]
                             """)
    parser.add_argument('--remove', action='append', default=[],
                        metavar="SECTION.KEY=VALUE[,VALUE]",
                        help="""Remove values from tempest.conf
                                Key value pair to be removed from the
                                configuration file.
                                NOTE: Multiple values are supposed to be
                                divided by a COLON only, WITHOUT spaces.
                                For example:
                                 $ discover-tempest-config \\
                                  --remove identity.username=myname \\
                                  --remove feature-enabled.api_ext=http[,https]
                             """)
    return parser


def parse_arguments():
    parser = get_arg_parser()
    args = parser.parse_args()
    if args.create and args.non_admin:
        raise Exception("Options '--create' and '--non-admin' cannot be used"
                        " together, since creating" " resources requires"
                        " admin rights")
    if args.test_accounts and args.create_accounts_file:
        raise Exception("Options '--test-accounts' and "
                        "'--create-accounts-file' can't be used together.")
    if args.network_id and args.network:
        raise Exception("--network-id is deprecated and will be replaced with"
                        " --network. Please, use only --network argument.")
    if args.network_id:
        LOG.warning("The --network-id is deprecated, please, use --network")
        args.network = args.network_id
    args.overrides = parse_overrides(args.overrides)
    return args


def parse_values_to_remove(options):
    """Manual parsing of remove arguments.

    :param options: list of arguments following --remove argument
    :return: dictionary containing key paths with values to be removed
    :rtype: dict
    EXAMPLE: {'identity.username': [myname],
              'identity-feature-enabled.api_extensions': [http, https]}
    """
    parsed = {}
    for argument in options:
        if len(argument.split('=')) == 2:
            section, values = argument.split('=')
            if len(section.split('.')) != 2:
                raise Exception("Missing dot. The option --remove has to "
                                "come in the format 'section.key=value[,value"
                                "]', but got '%s'." % argument)
            parsed[section] = values.split(',')
        else:
            # missing equal sign, all values in section.key will be deleted
            parsed[argument] = []
    return parsed


def parse_values_to_append(options):
    """Manual parsing of --append arguments.

    :param options: list of arguments following --append argument.
    :return: dictionary containing key paths with values to be added
    :rtype: dict
    """
    parsed = {}
    for argument in options:
        if len(argument.split('=')) == 2:
            section, values = argument.split('=')
            if len(section.split('.')) != 2:
                raise Exception("Missing dot. The option --append has to "
                                "come in the format 'section.key=value[,value"
                                "]', but got '%s'." % argument)
            if values == '':
                raise Exception("No values to append specified. The option "
                                "--append has to come in the format "
                                "'section.key=value[, value]', but got "
                                "'%s'" % values)
            parsed[section] = values.split(',')
        else:
            # missing equal sign, no values to add were specified, if a user
            # wants to just create a section, it can be done so via overrides
            raise Exception("Missing equal sign or more than just one found.")
    return parsed


def parse_overrides(overrides):
    """Manual parsing of positional arguments.

    :param overrides: list of section.keys and values to override, example:
               ['section.key', 'value', 'section.key', 'value']
    :return: list of tuples, example: [('section', 'key', 'value'), ...]
    :rtype: list
    """
    if len(overrides) % 2 != 0:
        raise Exception("An odd number of override options was found. The"
                        " overrides have to be in 'section.key value' format.")
    i = 0
    new_overrides = []
    while i < len(overrides):
        section_key = overrides[i].split('.')
        value = overrides[i + 1]
        if len(section_key) != 2:
            raise Exception("Missing dot. The option overrides has to come in"
                            " the format 'section.key value', but got '%s'."
                            % (overrides[i] + ' ' + value))
        section, key = section_key
        new_overrides.append((section, key, value))
        i += 2
    return new_overrides


def set_cloud_config_values(non_admin, cloud_creds, conf):
    """Set values from client's cloud config file.

    Set admin and non-admin credentials and uri from cloud credentials.
    Note: the values may be later overridden by values specified in CLI.

    :type non_admin: Boolean
    :param cloud_creds: auth data from openstacksdk
    :type cloud_creds: dict
    :param conf: TempestConf object
    """
    try:
        if non_admin:
            # Tempest doesn't have non-admin credentials, but we're gonna
            # keep them under identity for future usage
            conf.set('identity', 'username', cloud_creds['username'])
            conf.set('identity',
                     'project_name',
                     cloud_creds['project_name'])
            conf.set('identity', 'password', cloud_creds['password'])
            for cred in ['project_domain_name', 'user_domain_name']:
                if cred in cloud_creds:
                    conf.set('auth', cred, cloud_creds[cred])
        else:
            # admin credentials are under auth section
            conf.set('auth', 'admin_username', cloud_creds['username'])
            conf.set('auth',
                     'admin_project_name',
                     cloud_creds['project_name'])
            conf.set('auth', 'admin_password', cloud_creds['password'])
            for cred in [
                'domain_name', 'project_domain_name', 'user_domain_name'
            ]:
                if cred in cloud_creds:
                    conf.set('auth', f'admin_{cred}', cloud_creds[cred])

        conf.set('identity', 'uri', cloud_creds['auth_url'])

        if 'region_name' in cloud_creds:
            conf.set('identity', 'region', cloud_creds['region_name'])
    except cfg.NoSuchOptError:
        LOG.warning(
            'Could not load some identity options from cloud config file')


def get_cloud_creds(args_namespace):
    """Get cloud credentials based on argument namespace.

    If args contains --os-cloud argument, the method returns cloud
    credentials related to that cloud, otherwise, returns credentials
    of the current cloud.

    :type args_namespace: argparse.Namespace
    :return: cloud credentials
    :rtype: dict
    EXAMPLE: {'username': 'demo', 'project_name': 'demo',
              'user_domain_name': 'Default',
              'auth_url': 'http://172.16.52.8:5000/v3',
              'password': 'f0921edc3c2b4fc8', 'project_domain_name': 'Default'}
    """
    if args_namespace.os_cloud:
        cloud = openstack.connect(cloud=args_namespace.os_cloud)
    else:
        cloud = openstack.connect(argparse=args_namespace)

    cloud_creds = cloud.config.get_auth_args()
    region_name = cloud.config.config['region_name']
    if region_name:
        cloud_creds['region_name'] = region_name

    request_args = cloud.config.get_requests_verify_args()
    cloud_creds['request_args'] = {
        'verify': request_args[0],
        'cert': request_args[1],
    }

    return cloud_creds


def config_tempest(**kwargs):
    # convert a list of remove values to a dict
    remove = parse_values_to_remove(kwargs.get('remove', []))
    add = parse_values_to_append(kwargs.get('append', []))
    set_logging(kwargs.get('debug', False), kwargs.get('verbose', False))

    accounts_path = kwargs.get('test_accounts')
    if kwargs.get('create_accounts_file') is not None:
        accounts_path = kwargs.get('create_accounts_file')
    conf = TempestConf(write_credentials=accounts_path is None)
    set_options(conf, kwargs.get('deployer_input'),
                kwargs.get('non_admin', False),
                kwargs.get('image_path', C.DEFAULT_IMAGE),
                kwargs.get('overrides', []),
                accounts_path,
                kwargs.get('cloud_creds'))

    request_args = kwargs.get('cloud_creds', {}).get('request_args', {})
    credentials = Credentials(conf, not kwargs.get('non_admin', False),
                              **request_args)
    clients = ClientManager(conf, credentials)

    if kwargs.get('create', False) and kwargs.get('test_accounts') is None:
        users = Users(clients.projects, clients.roles, clients.users, conf)
        users.create_tempest_users()

    services = Services(clients, conf, credentials)

    if services.is_service(**{"type": "compute"}):
        flavors = Flavors(clients.flavors, kwargs.get('create', False), conf,
                          kwargs.get('flavor_min_mem', C.DEFAULT_FLAVOR_RAM),
                          kwargs.get('flavor_min_disk', C.DEFAULT_FLAVOR_DISK),
                          no_rng=kwargs.get('no_rng', False))
        flavors.create_tempest_flavors()

    if services.is_service(**{"type": "image"}):
        image = services.get_service('image')
        image.set_image_preferences(kwargs.get('image_disk_format',
                                               C.DEFAULT_IMAGE_FORMAT),
                                    kwargs.get('non_admin', False),
                                    no_rng=kwargs.get('no_rng', False),
                                    convert=kwargs.get('convert_to_raw',
                                                       False))
        retry_alt = kwargs.get('retry_image', False)
        image.create_tempest_images(conf, retry_alt=retry_alt)

    if services.is_service(**{"type": "network"}):
        network = services.get_service("network")
        network.create_tempest_networks(conf, kwargs.get('network'))

    services.post_configuration()
    services.set_supported_api_versions()
    services.set_service_extensions()

    if accounts_path is not None and kwargs.get('test_accounts') is None:
        LOG.info("Creating an accounts.yaml file in: %s", accounts_path)
        accounts.create_accounts_file(kwargs.get('create', False),
                                      accounts_path,
                                      conf)

    # remove all unwanted values if were specified
    if remove != {}:
        LOG.info("Removing configuration: %s", str(remove))
        conf.remove_values(remove)
    if add != {}:
        LOG.info("Adding configuration: %s", str(add))
        conf.append_values(add)
    out_path = kwargs.get('out', 'etc/tempest.conf')
    conf.write(out_path)


def main():
    args = parse_arguments()
    if args.generate_profile:
        profile.generate_profile(args, args.generate_profile)
        sys.exit(0)
    if args.profile:
        profile_args = profile.read_profile_file(args.profile)
        # update default args by values gained from the profile
        # Namespace can't be updated, so translate it to a dict first
        args_dict = vars(args)
        args_dict.update(profile_args)
        args = argparse.Namespace(**args_dict)
    cloud_creds = get_cloud_creds(args)
    config_tempest(
        append=args.append,
        cloud_creds=cloud_creds,
        convert_to_raw=args.convert_to_raw,
        create=args.create,
        create_accounts_file=args.create_accounts_file,
        debug=args.debug,
        deployer_input=args.deployer_input,
        flavor_min_mem=args.flavor_min_mem,
        flavor_min_disk=args.flavor_min_disk,
        image_disk_format=args.image_disk_format,
        image_path=args.image,
        network=args.network,
        non_admin=args.non_admin,
        no_rng=args.no_rng,
        os_cloud=args.os_cloud,
        out=args.out,
        overrides=args.overrides,
        remove=args.remove,
        test_accounts=args.test_accounts,
        verbose=args.verbose,
        retry_image=args.retry_image
    )


if __name__ == "__main__":
    main()