+def config_file_init(rift_vnfd_id, vdu, cfg_file):
+ """ Populate config file init with file provided
+ """
+ vnfd_package_store = rift.package.store.VnfdPackageFilesystemStore(logger)
+
+ # Get script contents from the file provided in the cloud_init directory
+ logger.debug("config file script provided in file {}".format(cfg_file))
+ filename = cfg_file
+ vnfd_package_store.refresh()
+ stored_package = vnfd_package_store.get_package(rift_vnfd_id)
+ cloud_init_extractor = rift.package.cloud_init.PackageCloudInitExtractor(logger)
+ try:
+ cfg_file_msg = cloud_init_extractor.read_script(stored_package, filename)
+ except rift.package.cloud_init.CloudInitExtractionError as e:
+ raise ValueError(e)
+
+ logger.debug("Current config file msg is {}".format(cfg_file_msg))
+ return cfg_file_msg
+