diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-19 18:10:34 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-19 18:10:34 +0000 |
commit | 2f5731cf536deff075d1011814f271cbb1ed67e2 (patch) | |
tree | f6e6dec098a60039b1413dae64d24c0bf55bf03d /app/models/blob_viewer | |
parent | 74b5b3ffcb9fe4d9424bc2bf35e43f749f76d023 (diff) | |
download | gitlab-ce-2f5731cf536deff075d1011814f271cbb1ed67e2.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/blob_viewer')
-rw-r--r-- | app/models/blob_viewer/metrics_dashboard_yml.rb | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/app/models/blob_viewer/metrics_dashboard_yml.rb b/app/models/blob_viewer/metrics_dashboard_yml.rb index 1ee7cad5094..c05fb5d88d6 100644 --- a/app/models/blob_viewer/metrics_dashboard_yml.rb +++ b/app/models/blob_viewer/metrics_dashboard_yml.rb @@ -26,10 +26,19 @@ module BlobViewer def parse_blob_data yaml = ::Gitlab::Config::Loader::Yaml.new(blob.data).load_raw! - Gitlab::Metrics::Dashboard::Validator - .errors(yaml, dashboard_path: blob.path, project: project) + + ::PerformanceMonitoring::PrometheusDashboard.from_json(yaml) + nil rescue Gitlab::Config::Loader::FormatError => error - [error] + wrap_yml_syntax_error(error) + rescue ActiveModel::ValidationError => invalid + invalid.model.errors + end + + def wrap_yml_syntax_error(error) + ::PerformanceMonitoring::PrometheusDashboard.new.errors.tap do |errors| + errors.add(:'YAML syntax', error.message) + end end end end |