Fixed logging out the OSCreds.
[snaps.git] / examples / launch.py
1 #!/usr/bin/python
2 #
3 # Copyright (c) 2017 Cable Television Laboratories, Inc. ("CableLabs")
4 #                    and others.  All rights reserved.
5 #
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:
9 #
10 #     http://www.apache.org/licenses/LICENSE-2.0
11 #
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.
17 #
18 # This script is responsible for deploying virtual environments
19 import argparse
20 import logging
21 import re
22
23 import os
24 from snaps import file_utils
25 from snaps.openstack.create_flavor import FlavorSettings, OpenStackFlavor
26 from snaps.openstack.create_image import ImageSettings, OpenStackImage
27 from snaps.openstack.create_instance import VmInstanceSettings
28 from snaps.openstack.create_keypairs import KeypairSettings
29 from snaps.openstack.create_network import PortSettings, NetworkSettings
30 from snaps.openstack.create_router import RouterSettings
31 from snaps.openstack.os_credentials import OSCreds, ProxySettings
32 from snaps.openstack.utils import deploy_utils
33 from snaps.provisioning import ansible_utils
34
35 __author__ = 'spisarski'
36
37 logger = logging.getLogger('deploy_venv')
38
39 ARG_NOT_SET = "argument not set"
40
41
42 def __get_os_credentials(os_conn_config):
43     """
44     Returns an object containing all of the information required to access
45     OpenStack APIs
46     :param os_conn_config: The configuration holding the credentials
47     :return: an OSCreds instance
48     """
49     proxy_settings = None
50     http_proxy = os_conn_config.get('http_proxy')
51     if http_proxy:
52         tokens = re.split(':', http_proxy)
53         ssh_proxy_cmd = os_conn_config.get('ssh_proxy_cmd')
54         proxy_settings = ProxySettings(host=tokens[0], port=tokens[1],
55                                        ssh_proxy_cmd=ssh_proxy_cmd)
56
57     os_conn_config['proxy_settings'] = proxy_settings
58
59     return OSCreds(**os_conn_config)
60
61
62 def __parse_ports_config(config):
63     """
64     Parses the "ports" configuration
65     :param config: The dictionary to parse
66     :return: a list of PortConfig objects
67     """
68     out = list()
69     for port_config in config:
70         out.append(PortSettings(**port_config.get('port')))
71     return out
72
73
74 def __create_flavors(os_conn_config, flavors_config, cleanup=False):
75     """
76     Returns a dictionary of flavors where the key is the image name and the
77     value is the image object
78     :param os_conn_config: The OpenStack connection credentials
79     :param flavors_config: The list of image configurations
80     :param cleanup: Denotes whether or not this is being called for cleanup
81     :return: dictionary
82     """
83     flavors = {}
84
85     if flavors_config:
86         try:
87             for flavor_config_dict in flavors_config:
88                 flavor_config = flavor_config_dict.get('flavor')
89                 if flavor_config and flavor_config.get('name'):
90                     flavor_creator = OpenStackFlavor(
91                         __get_os_credentials(os_conn_config),
92                         FlavorSettings(**flavor_config))
93                     flavor_creator.create(cleanup=cleanup)
94                     flavors[flavor_config['name']] = flavor_creator
95         except Exception as e:
96             for key, flavor_creator in flavors.items():
97                 flavor_creator.clean()
98             raise e
99         logger.info('Created configured flavors')
100
101     return flavors
102
103
104 def __create_images(os_conn_config, images_config, cleanup=False):
105     """
106     Returns a dictionary of images where the key is the image name and the
107     value is the image object
108     :param os_conn_config: The OpenStack connection credentials
109     :param images_config: The list of image configurations
110     :param cleanup: Denotes whether or not this is being called for cleanup
111     :return: dictionary
112     """
113     images = {}
114
115     if images_config:
116         try:
117             for image_config_dict in images_config:
118                 image_config = image_config_dict.get('image')
119                 if image_config and image_config.get('name'):
120                     images[image_config['name']] = deploy_utils.create_image(
121                         __get_os_credentials(os_conn_config),
122                         ImageSettings(**image_config), cleanup)
123         except Exception as e:
124             for key, image_creator in images.items():
125                 image_creator.clean()
126             raise e
127         logger.info('Created configured images')
128
129     return images
130
131
132 def __create_networks(os_conn_config, network_confs, cleanup=False):
133     """
134     Returns a dictionary of networks where the key is the network name and the
135     value is the network object
136     :param os_conn_config: The OpenStack connection credentials
137     :param network_confs: The list of network configurations
138     :param cleanup: Denotes whether or not this is being called for cleanup
139     :return: dictionary
140     """
141     network_dict = {}
142
143     if network_confs:
144         try:
145             for network_conf in network_confs:
146                 net_name = network_conf['network']['name']
147                 os_creds = __get_os_credentials(os_conn_config)
148                 network_dict[net_name] = deploy_utils.create_network(
149                     os_creds, NetworkSettings(**network_conf['network']),
150                     cleanup)
151         except Exception as e:
152             for key, net_creator in network_dict.items():
153                 net_creator.clean()
154             raise e
155
156         logger.info('Created configured networks')
157
158     return network_dict
159
160
161 def __create_routers(os_conn_config, router_confs, cleanup=False):
162     """
163     Returns a dictionary of networks where the key is the network name and the
164     value is the network object
165     :param os_conn_config: The OpenStack connection credentials
166     :param router_confs: The list of router configurations
167     :param cleanup: Denotes whether or not this is being called for cleanup
168     :return: dictionary
169     """
170     router_dict = {}
171     os_creds = __get_os_credentials(os_conn_config)
172
173     if router_confs:
174         try:
175             for router_conf in router_confs:
176                 router_name = router_conf['router']['name']
177                 router_dict[router_name] = deploy_utils.create_router(
178                     os_creds, RouterSettings(**router_conf['router']), cleanup)
179         except Exception as e:
180             for key, router_creator in router_dict.items():
181                 router_creator.clean()
182             raise e
183
184         logger.info('Created configured networks')
185
186     return router_dict
187
188
189 def __create_keypairs(os_conn_config, keypair_confs, cleanup=False):
190     """
191     Returns a dictionary of keypairs where the key is the keypair name and the
192     value is the keypair object
193     :param os_conn_config: The OpenStack connection credentials
194     :param keypair_confs: The list of keypair configurations
195     :param cleanup: Denotes whether or not this is being called for cleanup
196     :return: dictionary
197     """
198     keypairs_dict = {}
199     if keypair_confs:
200         try:
201             for keypair_dict in keypair_confs:
202                 keypair_config = keypair_dict['keypair']
203                 kp_settings = KeypairSettings(**keypair_config)
204                 keypairs_dict[
205                     keypair_config['name']] = deploy_utils.create_keypair(
206                     __get_os_credentials(os_conn_config), kp_settings, cleanup)
207         except Exception as e:
208             for key, keypair_creator in keypairs_dict.items():
209                 keypair_creator.clean()
210             raise e
211
212         logger.info('Created configured keypairs')
213
214     return keypairs_dict
215
216
217 def __create_instances(os_conn_config, instances_config, image_dict,
218                        keypairs_dict, cleanup=False):
219     """
220     Returns a dictionary of instances where the key is the instance name and
221     the value is the VM object
222     :param os_conn_config: The OpenStack connection credentials
223     :param instances_config: The list of VM instance configurations
224     :param image_dict: A dictionary of images that will probably be used to
225                        instantiate the VM instance
226     :param keypairs_dict: A dictionary of keypairs that will probably be used
227                           to instantiate the VM instance
228     :param cleanup: Denotes whether or not this is being called for cleanup
229     :return: dictionary
230     """
231     os_creds = __get_os_credentials(os_conn_config)
232
233     vm_dict = {}
234
235     if instances_config:
236         try:
237             for instance_config in instances_config:
238                 conf = instance_config.get('instance')
239                 if conf:
240                     if image_dict:
241                         image_creator = image_dict.get(conf.get('imageName'))
242                         if image_creator:
243                             instance_settings = VmInstanceSettings(
244                                 **instance_config['instance'])
245                             kp_name = conf.get('keypair_name')
246                             vm_dict[conf[
247                                 'name']] = deploy_utils.create_vm_instance(
248                                 os_creds, instance_settings,
249                                 image_creator.image_settings,
250                                 keypair_creator=keypairs_dict[kp_name],
251                                 cleanup=cleanup)
252                         else:
253                             raise Exception('Image creator instance not found.'
254                                             ' Cannot instantiate')
255                     else:
256                         raise Exception('Image dictionary is None. Cannot '
257                                         'instantiate')
258                 else:
259                     raise Exception('Instance configuration is None. Cannot '
260                                     'instantiate')
261         except Exception as e:
262             logger.error('Unexpected error creating instances. Attempting to '
263                          'cleanup environment - %s', e)
264             for key, inst_creator in vm_dict.items():
265                 inst_creator.clean()
266             raise e
267
268         logger.info('Created configured instances')
269     return vm_dict
270
271
272 def __apply_ansible_playbooks(ansible_configs, os_conn_config, vm_dict,
273                               image_dict, flavor_dict, env_file):
274     """
275     Applies ansible playbooks to running VMs with floating IPs
276     :param ansible_configs: a list of Ansible configurations
277     :param os_conn_config: the OpenStack connection configuration used to
278                            create an OSCreds instance
279     :param vm_dict: the dictionary of newly instantiated VMs where the name is
280                     the key
281     :param image_dict: the dictionary of newly instantiated images where the
282                        name is the key
283     :param flavor_dict: the dictionary of newly instantiated flavors where the
284                         name is the key
285     :param env_file: the path of the environment for setting the CWD so
286                      playbook location is relative to the deployment file
287     :return: t/f - true if successful
288     """
289     logger.info("Applying Ansible Playbooks")
290     if ansible_configs:
291         # Ensure all hosts are accepting SSH session requests
292         for vm_inst in list(vm_dict.values()):
293             if not vm_inst.vm_ssh_active(block=True):
294                 logger.warning(
295                     "Timeout waiting for instance to respond to SSH requests")
296                 return False
297
298         # Set CWD so the deployment file's playbook location can leverage
299         # relative paths
300         orig_cwd = os.getcwd()
301         env_dir = os.path.dirname(env_file)
302         os.chdir(env_dir)
303
304         # Apply playbooks
305         for ansible_config in ansible_configs:
306             os_creds = __get_os_credentials(os_conn_config)
307             __apply_ansible_playbook(ansible_config, os_creds, vm_dict,
308                                      image_dict, flavor_dict)
309
310         # Return to original directory
311         os.chdir(orig_cwd)
312
313     return True
314
315
316 def __apply_ansible_playbook(ansible_config, os_creds, vm_dict, image_dict,
317                              flavor_dict):
318     """
319     Applies an Ansible configuration setting
320     :param ansible_config: the configuration settings
321     :param os_creds: the OpenStack credentials object
322     :param vm_dict: the dictionary of newly instantiated VMs where the name is
323                     the key
324     :param image_dict: the dictionary of newly instantiated images where the
325                        name is the key
326     :param flavor_dict: the dictionary of newly instantiated flavors where the
327                         name is the key
328     """
329     if ansible_config:
330         (remote_user, floating_ips, private_key_filepath,
331          proxy_settings) = __get_connection_info(
332             ansible_config, vm_dict)
333         if floating_ips:
334             retval = ansible_utils.apply_playbook(
335                 ansible_config['playbook_location'], floating_ips, remote_user,
336                 private_key_filepath,
337                 variables=__get_variables(ansible_config.get('variables'),
338                                           os_creds, vm_dict, image_dict,
339                                           flavor_dict),
340                 proxy_setting=proxy_settings)
341             if retval != 0:
342                 # Not a fatal type of event
343                 logger.warning(
344                     'Unable to apply playbook found at location - ' +
345                     ansible_config('playbook_location'))
346
347
348 def __get_connection_info(ansible_config, vm_dict):
349     """
350     Returns a tuple of data required for connecting to the running VMs
351     (remote_user, [floating_ips], private_key_filepath, proxy_settings)
352     :param ansible_config: the configuration settings
353     :param vm_dict: the dictionary of VMs where the VM name is the key
354     :return: tuple where the first element is the user and the second is a list
355              of floating IPs and the third is the
356     private key file location and the fourth is an instance of the
357     snaps.ProxySettings class
358     (note: in order to work, each of the hosts need to have the same sudo_user
359     and private key file location values)
360     """
361     if ansible_config.get('hosts'):
362         hosts = ansible_config['hosts']
363         if len(hosts) > 0:
364             floating_ips = list()
365             remote_user = None
366             pk_file = None
367             proxy_settings = None
368             for host in hosts:
369                 vm = vm_dict.get(host)
370                 if vm:
371                     fip = vm.get_floating_ip()
372                     if fip:
373                         remote_user = vm.get_image_user()
374
375                         if fip:
376                             floating_ips.append(fip.ip)
377                         else:
378                             raise Exception(
379                                 'Could not find floating IP for VM - ' +
380                                 vm.name)
381
382                         pk_file = vm.keypair_settings.private_filepath
383                         proxy_settings = vm.get_os_creds().proxy_settings
384                 else:
385                     logger.error('Could not locate VM with name - ' + host)
386
387             return remote_user, floating_ips, pk_file, proxy_settings
388     return None
389
390
391 def __get_variables(var_config, os_creds, vm_dict, image_dict, flavor_dict):
392     """
393     Returns a dictionary of substitution variables to be used for Ansible
394     templates
395     :param var_config: the variable configuration settings
396     :param os_creds: the OpenStack credentials object
397     :param vm_dict: the dictionary of newly instantiated VMs where the name is
398                     the key
399     :param image_dict: the dictionary of newly instantiated images where the
400                        name is the key
401     :param flavor_dict: the dictionary of newly instantiated flavors where the
402                         name is the key
403     :return: dictionary or None
404     """
405     if var_config and vm_dict and len(vm_dict) > 0:
406         variables = dict()
407         for key, value in var_config.items():
408             value = __get_variable_value(value, os_creds, vm_dict, image_dict,
409                                          flavor_dict)
410             if key and value:
411                 variables[key] = value
412                 logger.info(
413                     "Set Jinga2 variable with key [%s] the value [%s]",
414                     key, value)
415             else:
416                 logger.warning('Key [%s] or Value [%s] must not be None',
417                                str(key), str(value))
418         return variables
419     return None
420
421
422 def __get_variable_value(var_config_values, os_creds, vm_dict, image_dict,
423                          flavor_dict):
424     """
425     Returns the associated variable value for use by Ansible for substitution
426     purposes
427     :param var_config_values: the configuration dictionary
428     :param os_creds: the OpenStack credentials object
429     :param vm_dict: the dictionary of newly instantiated VMs where the name is
430                     the key
431     :param image_dict: the dictionary of newly instantiated images where the
432                        name is the key
433     :param flavor_dict: the dictionary of newly instantiated flavors where the
434                         name is the key
435     :return:
436     """
437     if var_config_values['type'] == 'string':
438         return __get_string_variable_value(var_config_values)
439     if var_config_values['type'] == 'vm-attr':
440         return __get_vm_attr_variable_value(var_config_values, vm_dict)
441     if var_config_values['type'] == 'os_creds':
442         return __get_os_creds_variable_value(var_config_values, os_creds)
443     if var_config_values['type'] == 'port':
444         return __get_vm_port_variable_value(var_config_values, vm_dict)
445     if var_config_values['type'] == 'image':
446         return __get_image_variable_value(var_config_values, image_dict)
447     if var_config_values['type'] == 'flavor':
448         return __get_flavor_variable_value(var_config_values, flavor_dict)
449     return None
450
451
452 def __get_string_variable_value(var_config_values):
453     """
454     Returns the associated string value
455     :param var_config_values: the configuration dictionary
456     :return: the value contained in the dictionary with the key 'value'
457     """
458     return var_config_values['value']
459
460
461 def __get_vm_attr_variable_value(var_config_values, vm_dict):
462     """
463     Returns the associated value contained on a VM instance
464     :param var_config_values: the configuration dictionary
465     :param vm_dict: the dictionary containing all VMs where the key is the VM's
466                     name
467     :return: the value
468     """
469     vm = vm_dict.get(var_config_values['vm_name'])
470     if vm:
471         if var_config_values['value'] == 'floating_ip':
472             return vm.get_floating_ip().ip
473         if var_config_values['value'] == 'image_user':
474             return vm.get_image_user()
475
476
477 def __get_os_creds_variable_value(var_config_values, os_creds):
478     """
479     Returns the associated OS credentials value
480     :param var_config_values: the configuration dictionary
481     :param os_creds: the credentials
482     :return: the value
483     """
484     logger.info("Retrieving OS Credentials")
485     if os_creds:
486         if var_config_values['value'] == 'username':
487             logger.info("Returning OS username")
488             return os_creds.username
489         elif var_config_values['value'] == 'password':
490             logger.info("Returning OS password")
491             return os_creds.password
492         elif var_config_values['value'] == 'auth_url':
493             logger.info("Returning OS auth_url")
494             return os_creds.auth_url
495         elif var_config_values['value'] == 'project_name':
496             logger.info("Returning OS project_name")
497             return os_creds.project_name
498
499     logger.info("Returning none")
500     return None
501
502
503 def __get_vm_port_variable_value(var_config_values, vm_dict):
504     """
505     Returns the associated OS credentials value
506     :param var_config_values: the configuration dictionary
507     :param vm_dict: the dictionary containing all VMs where the key is the VM's
508                     name
509     :return: the value
510     """
511     port_name = var_config_values.get('port_name')
512     vm_name = var_config_values.get('vm_name')
513
514     if port_name and vm_name:
515         vm = vm_dict.get(vm_name)
516         if vm:
517             port_value_id = var_config_values.get('port_value')
518             if port_value_id:
519                 if port_value_id == 'mac_address':
520                     return vm.get_port_mac(port_name)
521                 if port_value_id == 'ip_address':
522                     return vm.get_port_ip(port_name)
523
524
525 def __get_image_variable_value(var_config_values, image_dict):
526     """
527     Returns the associated image value
528     :param var_config_values: the configuration dictionary
529     :param image_dict: the dictionary containing all images where the key is
530                        the name
531     :return: the value
532     """
533     logger.info("Retrieving image values")
534
535     if image_dict:
536         if var_config_values.get('image_name'):
537             image_creator = image_dict.get(var_config_values['image_name'])
538             if image_creator:
539                 if var_config_values.get('value') and \
540                                 var_config_values['value'] == 'id':
541                     return image_creator.get_image().id
542                 if var_config_values.get('value') and \
543                         var_config_values['value'] == 'user':
544                     return image_creator.image_settings.image_user
545
546     logger.info("Returning none")
547     return None
548
549
550 def __get_flavor_variable_value(var_config_values, flavor_dict):
551     """
552     Returns the associated flavor value
553     :param var_config_values: the configuration dictionary
554     :param flavor_dict: the dictionary containing all flavor creators where the
555                         key is the name
556     :return: the value or None
557     """
558     logger.info("Retrieving flavor values")
559
560     if flavor_dict:
561         if var_config_values.get('flavor_name'):
562             flavor_creator = flavor_dict.get(var_config_values['flavor_name'])
563             if flavor_creator:
564                 if var_config_values.get('value') and \
565                                 var_config_values['value'] == 'id':
566                     return flavor_creator.get_flavor().id
567
568
569 def main(arguments):
570     """
571     Will need to set environment variable ANSIBLE_HOST_KEY_CHECKING=False or
572     Create a file located in /etc/ansible/ansible/cfg or ~/.ansible.cfg
573     containing the following content:
574
575     [defaults]
576     host_key_checking = False
577
578     CWD must be this directory where this script is located.
579
580     :return: To the OS
581     """
582     log_level = logging.INFO
583     if arguments.log_level != 'INFO':
584         log_level = logging.DEBUG
585     logging.basicConfig(level=log_level)
586
587     logger.info('Starting to Deploy')
588     config = file_utils.read_yaml(arguments.environment)
589     logger.debug('Read configuration file - ' + arguments.environment)
590
591     if config:
592         os_config = config.get('openstack')
593
594         os_conn_config = None
595         creators = list()
596         vm_dict = dict()
597         images_dict = dict()
598         flavors_dict = dict()
599
600         if os_config:
601             try:
602                 os_conn_config = os_config.get('connection')
603
604                 # Create flavors
605                 flavors_dict = __create_flavors(
606                     os_conn_config, os_config.get('flavors'),
607                     arguments.clean is not ARG_NOT_SET)
608                 creators.append(flavors_dict)
609
610                 # Create images
611                 images_dict = __create_images(
612                     os_conn_config, os_config.get('images'),
613                     arguments.clean is not ARG_NOT_SET)
614                 creators.append(images_dict)
615
616                 # Create network
617                 creators.append(__create_networks(
618                     os_conn_config, os_config.get('networks'),
619                     arguments.clean is not ARG_NOT_SET))
620
621                 # Create routers
622                 creators.append(__create_routers(
623                     os_conn_config, os_config.get('routers'),
624                     arguments.clean is not ARG_NOT_SET))
625
626                 # Create keypairs
627                 keypairs_dict = __create_keypairs(
628                     os_conn_config, os_config.get('keypairs'),
629                     arguments.clean is not ARG_NOT_SET)
630                 creators.append(keypairs_dict)
631
632                 # Create instance
633                 vm_dict = __create_instances(
634                     os_conn_config, os_config.get('instances'),
635                     images_dict, keypairs_dict,
636                     arguments.clean is not ARG_NOT_SET)
637                 creators.append(vm_dict)
638                 logger.info(
639                     'Completed creating/retrieving all configured instances')
640             except Exception as e:
641                 logger.error(
642                     'Unexpected error deploying environment. Rolling back due'
643                     ' to - ' + str(e))
644                 __cleanup(creators)
645                 raise
646
647         # Must enter either block
648         if arguments.clean is not ARG_NOT_SET:
649             # Cleanup Environment
650             __cleanup(creators, arguments.clean_image is not ARG_NOT_SET)
651         elif arguments.deploy is not ARG_NOT_SET:
652             logger.info('Configuring NICs where required')
653             for vm in vm_dict.values():
654                 vm.config_nics()
655             logger.info('Completed NIC configuration')
656
657             # Provision VMs
658             ansible_config = config.get('ansible')
659             if ansible_config and vm_dict:
660                 if not __apply_ansible_playbooks(ansible_config,
661                                                  os_conn_config, vm_dict,
662                                                  images_dict, flavors_dict,
663                                                  arguments.environment):
664                     logger.error("Problem applying ansible playbooks")
665     else:
666         logger.error(
667             'Unable to read configuration file - ' + arguments.environment)
668         exit(1)
669
670     exit(0)
671
672
673 def __cleanup(creators, clean_image=False):
674     for creator_dict in reversed(creators):
675         for key, creator in creator_dict.items():
676             if (isinstance(creator, OpenStackImage) and clean_image) or \
677                     not isinstance(creator, OpenStackImage):
678                 try:
679                     creator.clean()
680                 except Exception as e:
681                     logger.warning('Error cleaning component - %s', e)
682
683
684 if __name__ == '__main__':
685     # To ensure any files referenced via a relative path will begin from the
686     # directory in which this file resides
687     os.chdir(os.path.dirname(os.path.realpath(__file__)))
688
689     parser = argparse.ArgumentParser()
690     parser.add_argument(
691         '-d', '--deploy', dest='deploy', nargs='?', default=ARG_NOT_SET,
692         help='When used, environment will be deployed and provisioned')
693     parser.add_argument(
694         '-c', '--clean', dest='clean', nargs='?', default=ARG_NOT_SET,
695         help='When used, the environment will be removed')
696     parser.add_argument(
697         '-i', '--clean-image', dest='clean_image', nargs='?',
698         default=ARG_NOT_SET,
699         help='When cleaning, if this is set, the image will be cleaned too')
700     parser.add_argument(
701         '-e', '--env', dest='environment', required=True,
702         help='The environment configuration YAML file - REQUIRED')
703     parser.add_argument(
704         '-l', '--log-level', dest='log_level', default='INFO',
705         help='Logging Level (INFO|DEBUG)')
706     args = parser.parse_args()
707
708     if args.deploy is ARG_NOT_SET and args.clean is ARG_NOT_SET:
709         print(
710             'Must enter either -d for deploy or -c for cleaning up and '
711             'environment')
712         exit(1)
713     if args.deploy is not ARG_NOT_SET and args.clean is not ARG_NOT_SET:
714         print('Cannot enter both options -d/--deploy and -c/--clean')
715         exit(1)
716     main(args)