Sha256: 1af2c3e644297176330c8f69f521820f5aee767989fd0ee38adbc3dcc488c2f7

Contents?: true

Size: 596 Bytes

Versions: 156

Compression:

Stored size: 596 Bytes

Contents

require 'net/scp'
require 'open3'
require 'sidekiq'

class WcoHosting::CertbotJob
  include Sidekiq::Job
  sidekiq_options queue: 'wasya_co_rb'

  def perform id
    puts! id, 'CertbotJob#perform...'

    app = WcoHosting::Appliance.find id
    cmd = "ssh #{app.serverhost.ssh_host} 'certbot run -d #{app.host} --nginx -n ' "
    stdout, stderr, status = Open3.capture3(cmd)
    status = status.to_s.split.last.to_i

    if 0 != status && 0 != app.n_retries
      app.update_attributes({ n_retries: app.n_retries - 1 })
      CertbotJob.perform_in( 15.minutes, app.id.to_s )
    end

  end

end

Version data entries

156 entries across 156 versions & 1 rubygems

Version Path
wco_models-3.1.0.202 app/jobs/wco_hosting/certbot_job.rb
wco_models-3.1.0.201 app/jobs/wco_hosting/certbot_job.rb
wco_models-3.1.0.199 app/jobs/wco_hosting/certbot_job.rb
wco_models-3.1.0.198 app/jobs/wco_hosting/certbot_job.rb
wco_models-3.1.0.197 app/jobs/wco_hosting/certbot_job.rb
wco_models-3.1.0.196 app/jobs/wco_hosting/certbot_job.rb
wco_models-3.1.0.195 app/jobs/wco_hosting/certbot_job.rb
wco_models-3.1.0.194 app/jobs/wco_hosting/certbot_job.rb
wco_models-3.1.0.193 app/jobs/wco_hosting/certbot_job.rb
wco_models-3.1.0.192 app/jobs/wco_hosting/certbot_job.rb
wco_models-3.1.0.191 app/jobs/wco_hosting/certbot_job.rb
wco_models-3.1.0.190 app/jobs/wco_hosting/certbot_job.rb
wco_models-3.1.0.189 app/jobs/wco_hosting/certbot_job.rb
wco_models-3.1.0.188 app/jobs/wco_hosting/certbot_job.rb
wco_models-3.1.0.187 app/jobs/wco_hosting/certbot_job.rb
wco_models-3.1.0.184 app/jobs/wco_hosting/certbot_job.rb
wco_models-3.1.0.183 app/jobs/wco_hosting/certbot_job.rb
wco_models-3.1.0.182 app/jobs/wco_hosting/certbot_job.rb
wco_models-3.1.0.181 app/jobs/wco_hosting/certbot_job.rb
wco_models-3.1.0.180 app/jobs/wco_hosting/certbot_job.rb