Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw an error on a duplicate copy, expand website #2204

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions products/cloudbuild/inspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,3 @@

--- !ruby/object:Provider::Inspec::Config
overrides: !ruby/object:Overrides::ResourceOverrides
files: !ruby/object:Provider::Config::Files
copy:
'Gemfile': 'provider/inspec/Gemfile'
3 changes: 0 additions & 3 deletions products/cloudfunctions/inspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,3 @@ overrides: !ruby/object:Overrides::ResourceOverrides
properties:
trigger_http: !ruby/object:Overrides::Inspec::PropertyOverride
exclude: true
files: !ruby/object:Provider::Config::Files
copy:
'Gemfile': 'provider/inspec/Gemfile'
3 changes: 0 additions & 3 deletions products/compute/inspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,3 @@ overrides: !ruby/object:Overrides::ResourceOverrides
exclude: true
Zone: !ruby/object:Overrides::Inspec::ResourceOverride
exclude: true
files: !ruby/object:Provider::Config::Files
copy:
'Gemfile': 'provider/inspec/Gemfile'
3 changes: 0 additions & 3 deletions products/container/inspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,3 @@ overrides: !ruby/object:Overrides::ResourceOverrides
properties:
cluster: !ruby/object:Overrides::Inspec::PropertyOverride
resource: 'RegionalCluster'
files: !ruby/object:Provider::Config::Files
copy:
'Gemfile': 'provider/inspec/Gemfile'
4 changes: 1 addition & 3 deletions products/dns/inspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,4 @@ overrides: !ruby/object:Overrides::ResourceOverrides
base_url: projects/{{project}}/managedZones/{{managed_zone}}/rrsets
Project: !ruby/object:Overrides::Inspec::ResourceOverride
exclude: true
files: !ruby/object:Provider::Config::Files
copy:
'Gemfile': 'provider/inspec/Gemfile'

3 changes: 0 additions & 3 deletions products/pubsub/inspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,3 @@ overrides: !ruby/object:Overrides::ResourceOverrides
properties:
name: !ruby/object:Overrides::Inspec::PropertyOverride
name_from_self_link: true
files: !ruby/object:Provider::Config::Files
copy:
'Gemfile': 'provider/inspec/Gemfile'
3 changes: 0 additions & 3 deletions products/resourcemanager/inspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,3 @@ overrides: !ruby/object:Overrides::ResourceOverrides
product_url: https://cloudresourcemanager.googleapis.com/v2/
# Creating and viewing folders requires organization level privileges
privileged: true
files: !ruby/object:Provider::Config::Files
copy:
'Gemfile': 'provider/inspec/Gemfile'
8 changes: 8 additions & 0 deletions provider/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,20 @@ def copy_common_files(output_folder, version_name = 'ga', provider_name = nil)
# rubocop:enable Lint/UnusedMethodArgument

def copy_file_list(output_folder, files)
puts "start_time is #{@start_time}"
files.map do |target, source|
Thread.new do
target_file = File.join(output_folder, target)
target_dir = File.dirname(target_file)
Google::LOGGER.debug "Copying #{source} => #{target}"
FileUtils.mkpath target_dir unless Dir.exist?(target_dir)

# If we've modified a file since starting an MM run, it's a reasonable
# assumption that it was this run that modified it.
if File.exist?(target_file) && File.mtime(target_file) > @start_time
raise "#{target_file} was already modified during this run. #{File.mtime(target_file)}"
end

FileUtils.copy_entry source, target_file
end
end.map(&:join)
Expand Down
1 change: 1 addition & 0 deletions provider/inspec/common~copy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
'libraries/google/iam/property/iam_policy_audit_configs.rb': 'templates/inspec/iam_policy/properties/iam_policy_audit_configs.rb'
'libraries/google/iam/property/iam_policy_audit_configs_audit_log_configs.rb': 'templates/inspec/iam_policy/properties/iam_policy_audit_configs_audit_log_configs.rb'
'libraries/google/iam/property/iam_policy_bindings.rb': 'templates/inspec/iam_policy/properties/iam_policy_bindings.rb'
'Gemfile': 'provider/inspec/Gemfile'
6 changes: 5 additions & 1 deletion provider/terraform/common~copy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,9 @@
'<%= fname -%>': '<%= file_path -%>'
<% end -%>
'<%= dir -%>/test-fixtures/': 'third_party/terraform/utils/test-fixtures'
'website': 'third_party/terraform/website'
<% Dir["third_party/terraform/website/**/*.*"].each do |file_path|
fname = file_path.split('/', 4)[3]
-%>
'website/<%= fname -%>': 'third_party/terraform/website/<%= fname -%>'
<% end -%>
'version': 'third_party/terraform/version'