def get_project(project_list, item):
# project_list = ctx.obj.project.list()
- item_project_list = item.get('_admin').get('projects_read')
+ item_project_list = item.get('_admin', {}).get('projects_read')
project_id = 'None'
project_name = 'None'
if item_project_list:
table = PrettyTable(['nfpkg name', 'id', 'desc type'])
for vnfd in resp:
name = vnfd.get('id', vnfd.get('name','-'))
- descriptor_type = 'sol005' if 'product-name' in vnfd else 'rel8'
+ descriptor_type = 'sol006' if 'product-name' in vnfd else 'rel8'
if long:
onb_state = vnfd['_admin'].get('onboardingState','-')
op_state = vnfd['_admin'].get('operationalState','-')
except:
vim_list = []
for cluster in resp:
+ logger.debug('Cluster details: {}'.format(yaml.safe_dump(cluster)))
vim_name = get_vim_name(vim_list, cluster['vim_account'])
#vim_info = '{} ({})'.format(vim_name,cluster['vim_account'])
vim_info = vim_name
op_state_details = "Helm: {}\nJuju: {}".format(
- cluster["_admin"].get("helm-chart", "-").get("operationalState", "-"),
- cluster["_admin"].get("juju-bundle", "-").get("operationalState", "-"))
+ cluster["_admin"].get("helm-chart", {}).get("operationalState", "-"),
+ cluster["_admin"].get("juju-bundle", {}).get("operationalState", "-"))
if long:
- logger.debug('Cluster details: {}'.format(yaml.safe_dump(cluster)))
project_id, project_name = get_project(project_list, cluster)
#project_info = '{} ({})'.format(project_name, project_id)
project_info = project_name
# exit(1)
@cli_osm.command(name='package-validate',
- short_help='Validate a package descriptor')
+ short_help='Validate a package descriptor')
@click.argument('base-directory',
default=".",
required=False)
default=True,
help='The activated recursive option will validate the yaml files'
' within the indicated directory and in its subdirectories')
+@click.option('--old',
+ is_flag=True,
+ default=False,
+ help='Validates also the descriptors using the previous OSM format (pre SOL006)')
@click.pass_context
def package_validate(ctx,
base_directory,
- recursive):
+ recursive,
+ old):
"""
Validate descriptors given a base directory.
"""
# try:
check_client_version(ctx.obj, ctx.command.name)
- results = ctx.obj.package_tool.validate(base_directory, recursive)
+ results = ctx.obj.package_tool.validate(base_directory, recursive, old)
table = PrettyTable()
table.field_names = ["TYPE", "PATH", "VALID", "ERROR"]
# Print the dictionary generated by the validation function