Skip to content

Commit

Permalink
Check service start
Browse files Browse the repository at this point in the history
  • Loading branch information
malvads committed Jun 11, 2024
1 parent f484014 commit 29209bf
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 17 deletions.
4 changes: 4 additions & 0 deletions resources/libraries/minio_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ def self.check_remote_hosts(hosts)
all_alive
end

def self.exists_minio_conf?
File.exist?('/etc/default/minio')
end

def self.s3_ready?
command_output = `serf members list`

Expand Down
37 changes: 20 additions & 17 deletions resources/providers/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
ignore_failure true
supports status: true, reload: true, restart: true, enable: true
action [:enable, :start]
only_if { Minio::Helpers.exists_minio_conf? }
end

template '/etc/default/minio' do
Expand All @@ -49,25 +50,27 @@
notifies :restart, 'service[minio]', :delayed
end

template '/etc/redborder/s3_init_conf.yml' do
source 's3_init_conf.yml.erb'
variables(
s3_user: s3_user,
s3_password: s3_password,
s3_bucket: s3_bucket,
s3_endpoint: s3_endpoint
)
end
if !Minio::Helpers.s3_ready?
template '/etc/redborder/s3_init_conf.yml' do
source 's3_init_conf.yml.erb'
variables(
s3_user: s3_user,
s3_password: s3_password,
s3_bucket: s3_bucket,
s3_endpoint: s3_endpoint
)
end

template '/root/.s3cfg_initial' do
source 's3cfg_initial.erb'
variables(
s3_user: s3_user,
s3_password: s3_password,
s3_endpoint: s3_endpoint
)
template '/root/.s3cfg_initial' do
source 's3cfg_initial.erb'
variables(
s3_user: s3_user,
s3_password: s3_password,
s3_endpoint: s3_endpoint
)
end
end

Chef::Log.info('Minio cookbook has been processed')
rescue => e
Chef::Log.error(e.message)
Expand Down

0 comments on commit 29209bf

Please sign in to comment.