Skip to content

Commit

Permalink
Move failed_resource? one level up
Browse files Browse the repository at this point in the history
Signed-off-by: Omer Demirok <odemirok@chef.io>
  • Loading branch information
Omer Demirok authored and Stuart Paterson committed Sep 8, 2020
1 parent 3dd18e9 commit 3416190
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
7 changes: 0 additions & 7 deletions libraries/azure_backend.rb
Original file line number Diff line number Diff line change
Expand Up @@ -433,13 +433,6 @@ def catch_failed_resource_queries
resource_fail(message)
end

# Track the status of the resource at InSpec Azure resource pack level.
#
# @return [TrueClass, FalseClass] Whether the resource is failed or not.
def failed_resource?
@failed_resource ||= false
end

# Ensure required parameters have been set to perform backend operations.
#
# Some resources may require several parameters to be set, in which case use `required`.
Expand Down
7 changes: 7 additions & 0 deletions libraries/azure_generic_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,11 @@ def resource_group
res_group, _provider, _res_type = Helpers.res_group_provider_type_from_uri(id)
res_group
end

# Track the status of the resource at InSpec Azure resource pack level.
#
# @return [TrueClass, FalseClass] Whether the resource is failed or not.
def failed_resource?
@failed_resource ||= false
end
end
7 changes: 7 additions & 0 deletions libraries/azure_graph_generic_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,11 @@ def to_s(class_name = nil)
"#{class_name.name.split('_').map(&:capitalize).join(' ')} #{api_info}: #{@display_name}"
end
end

# Track the status of the resource at InSpec Azure resource pack level.
#
# @return [TrueClass, FalseClass] Whether the resource is failed or not.
def failed_resource?
@failed_resource ||= false
end
end
8 changes: 8 additions & 0 deletions libraries/azure_graph_generic_resources.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,12 @@ def self.populate_filter_table(raw_data, table_scheme)
end
filter_table.install_filter_methods_on_resource(self, raw_data)
end

# Return the InSpec level resource failure.
# This is a diversion from singular resources
# since an empty response from API should not be considered as failure.
# FilterTable will respond properly when it is an empty response.
def failed_resource?
resource_failed?
end
end

0 comments on commit 3416190

Please sign in to comment.