Skip to content

Commit

Permalink
Add support for managing file blob stores
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorific committed Jan 11, 2025
1 parent 5e5a679 commit 8bd0adc
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
8 changes: 7 additions & 1 deletion cookbooks/boxcutter_sonatype/attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
},
'properties' => {
},
'blobstores' => {},
'blobstores' => {
'default' => {
'name' => 'default',
'type' => 'file',
'path' => 'default',
}
},
'repositories' => {},
}
11 changes: 11 additions & 0 deletions cookbooks/boxcutter_sonatype/libraries/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,15 @@ def self.repository_delete(node, repository_name)
puts "MISCHA: DELETE response body: #{response.body}"
end

def self.blobstore_create_file_payload(blobstore_name, blobstore_config)
payload = {
'name' => blobstore_name,
'path' => blobstore_config['path'],
}

payload.to_json
end

def self.blobstore_create_s3_payload(blobstore_name, blobstore_config)
payload = {
'name' => blobstore_name,
Expand Down Expand Up @@ -405,6 +414,8 @@ def self.blobstore_create(node, blobstore_name, blobstore_config)
uri = URI.parse("http://localhost:8081/service/rest/v1/blobstores/#{blobstore_type}")

case blobstore_config['type']
when 'file'
payload = blobstore_create_file_payload(blobstore_name, blobstore_config)
when 's3'
payload = blobstore_create_s3_payload(blobstore_name, blobstore_config)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,18 @@
node.run_state['boxcutter_sonatype'] ||= {}
node.run_state['boxcutter_sonatype']['nexus_repository'] ||= {}
node.run_state['boxcutter_sonatype']['nexus_repository']['admin_username'] = 'admin'
node.run_state['boxcutter_sonatype']['nexus_repository']['admin_password'] = 'Superseekret63'
node.run_state['boxcutter_sonatype']['nexus_repository']['admin_password'] = 'Superseekret63'
# node.run_state['boxcutter_sonatype']['nexus_repository']['admin_username'] = 'chef'
# node.run_state['boxcutter_sonatype']['nexus_repository']['admin_password'] = 'sucre-canonize-ROADSTER-bashful'

node.default['boxcutter_sonatype']['nexus_repository']['blobstores'] = {
'default' => {
'name' => 'default',
'type' => 'file',
'path' => 'default',
}
}

node.default['boxcutter_sonatype']['nexus_repository']['repositories'] = {
'testy-hosted' => {
'name' => 'testy-hosted',
Expand Down

0 comments on commit 8bd0adc

Please sign in to comment.