Skip to content

Commit

Permalink
Rename organizations_products_scoped to organizations_products to ref…
Browse files Browse the repository at this point in the history
…lect the used endpoint
  • Loading branch information
felixsch committed Apr 26, 2018
1 parent bb8647f commit 6bbada2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/rmt/scc.rb
Expand Up @@ -40,7 +40,7 @@ def export(path)
scc_api_client = SUSE::Connect::Api.new(Settings.scc.username, Settings.scc.password)

@logger.info('Exporting products')
File.write(File.join(path, 'organizations_products_scoped.json'), scc_api_client.list_products.to_json)
File.write(File.join(path, 'organizations_products.json'), scc_api_client.list_products.to_json)
# For SUMA, we also export the unscoped products with the filename it expects.
File.write(File.join(path, 'organizations_products_unscoped.json'), scc_api_client.list_products_unscoped.to_json)

Expand All @@ -55,7 +55,7 @@ def export(path)
end

def import(path)
missing_files = %w[products_scoped repositories subscriptions]
missing_files = %w[products repositories subscriptions]
.map { |data| "organizations_#{data}.json" }
.reject { |filename| File.exist?(File.join(path, filename)) }
raise DataFilesError, "Missing data files: #{missing_files.join(', ')}" if missing_files.any?
Expand All @@ -65,7 +65,7 @@ def import(path)
@logger.info("Importing SCC data from #{path}")

@logger.info('Updating products')
data = JSON.parse(File.read(File.join(path, 'organizations_products_scoped.json')), symbolize_names: true)
data = JSON.parse(File.read(File.join(path, 'organizations_products.json')), symbolize_names: true)
data.each do |item|
@logger.debug("Adding product #{item[:identifier]}/#{item[:version]}#{(item[:arch]) ? '/' + item[:arch] : ''}")
create_product(item)
Expand Down
4 changes: 2 additions & 2 deletions spec/lib/rmt/scc_spec.rb
Expand Up @@ -279,7 +279,7 @@ def scc
allow(Settings).to receive(:scc).and_return(OpenStruct.new(username: 'me', password: 'groot'))
end

%w[orders products_unscoped products_scoped repositories subscriptions].each do |data|
%w[orders products_unscoped products repositories subscriptions].each do |data|
it "writes #{data} file to path" do
FakeFS.with_fresh do
FileUtils.mkdir_p path
Expand Down Expand Up @@ -309,7 +309,7 @@ def scc
before do
FakeFS.with_fresh do
FileUtils.mkdir_p(path)
File.write(File.join(path, 'organizations_products_scoped.json'), products.to_json)
File.write(File.join(path, 'organizations_products.json'), products.to_json)
File.write(File.join(path, 'organizations_subscriptions.json'), subscriptions.to_json)
File.write(File.join(path, 'organizations_repositories.json'), all_repositories.to_json)

Expand Down

0 comments on commit 6bbada2

Please sign in to comment.