# License for the specific language governing permissions and limitations
# under the License.
-from osmclient.common.exceptions import ClientException
-import os
import glob
-import time
-import tarfile
import hashlib
-from osm_im.validation import Validation as validation_im
-from jinja2 import Environment, PackageLoader
-import subprocess
+import logging
+import os
import shutil
+import subprocess
+import tarfile
+import time
+
+from jinja2 import Environment, PackageLoader
+from osm_im.validation import Validation as validation_im
+from osmclient.common.exceptions import ClientException
import yaml
-import logging
class PackageTool(object):
listCharms = self.charms_search(file, 'ns')
print("List of charms in the descriptor: {}".format(listCharms))
if not descriptor_file:
- raise ClientException ('descriptor name is not correct in: {}'.format(package_folder))
+ raise ClientException('descriptor name is not correct in: {}'.format(package_folder))
if listCharms and not skip_charm_build:
for charmName in listCharms:
- if os.path.isdir('{}/charms/layers/{}'.format(package_folder,charmName)):
+ if os.path.isdir('{}/charms/layers/{}'.format(package_folder, charmName)):
print('Building charm {}/charms/layers/{}'.format(package_folder, charmName))
self.charm_build(package_folder, charmName)
print('Charm built: {}'.format(charmName))
else:
- if not os.path.isdir('{}/charms/{}'.format(package_folder,charmName)):
- raise ClientException ('The charm: {} referenced in the descriptor file '
- 'is not present either in {}/charms or in {}/charms/layers'.
- format(charmName, package_folder,package_folder))
+ if not os.path.isdir('{}/charms/{}'.format(package_folder, charmName)):
+ raise ClientException('The charm: {} referenced in the descriptor file '
+ 'is not present either in {}/charms or in {}/charms/layers'.
+ format(charmName, package_folder, package_folder))
self._logger.debug("Return list of charms: {}".format(listCharms))
return listCharms
shutil.copytree(s_charm, d_temp, symlinks=True, ignore=ignore)
self._logger.debug("DONE")
else:
- self._logger.debug("Copying tree: {} -> {}".format(s,d))
+ self._logger.debug("Copying tree: {} -> {}".format(s, d))
shutil.copytree(s, d, symlinks=True, ignore=ignore)
self._logger.debug("DONE")
else:
if item in ignore_patterns:
continue
- self._logger.debug("Copying file: {} -> {}".format(s,d))
+ self._logger.debug("Copying file: {} -> {}".format(s, d))
shutil.copy2(s, d)
self._logger.debug("DONE")
return directory_name, package_name
self._logger.debug("")
with open("{}".format(descriptor_file)) as yaml_desc:
descriptor_dict = yaml.safe_load(yaml_desc)
- if "catalog" in descriptor_dict: # Match OSM-IM vnfd-catalog and nsd-catalog
- charms_list = self._charms_search_on_osm_im_dict(descriptor_dict, desc_type)
- else:
+ if "catalog" in descriptor_dict: # Match OSM-IM vnfd-catalog and nsd-catalog
charms_list = self._charms_search_on_sol006_dict(descriptor_dict, desc_type)
+ else:
+ charms_list = self._charms_search_on_osm_im_dict(descriptor_dict, desc_type)
return charms_list
if 'charm' in v3:
charms_list.append((v3['charm']))
return charms_list
-