Skip to content

Commit

Permalink
Merge pull request #98 from fosslight/develop
Browse files Browse the repository at this point in the history
Add options when parsing yaml
  • Loading branch information
soimkim authored Nov 25, 2022
2 parents 03eb50b + ab0ef80 commit 868f0bb
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/fosslight_util/parsing_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
EXAMPLE_OSS_PKG_INFO_LINK = "https://github.com/fosslight/fosslight_prechecker/blob/main/tests/convert/sbom-info.yaml"


def parsing_yml(yaml_file, base_path):
def parsing_yml(yaml_file, base_path, print_log=True):
oss_list = []
license_list = []
idx = 1
Expand Down Expand Up @@ -51,9 +51,13 @@ def parsing_yml(yaml_file, base_path):
license_list.extend(item.license)
idx += 1
except AttributeError as ex:
_logger.error(f"Not supported yaml file format {ex}")
if print_log:
_logger.error(f"Not supported yaml file format {ex}")
oss_list = []
except yaml.YAMLError:
_logger.warning(f"Can't parse yaml - skip to parse yaml file: {yaml_file}")
if print_log:
_logger.warning(f"Can't parse yaml - skip to parse yaml file: {yaml_file}")
oss_list = []
return oss_list, set(license_list)


Expand Down

0 comments on commit 868f0bb

Please sign in to comment.