Class: ProconBypassMan::RemoteAction::RemotePbmJob::ChangePbmVersionAction

Inherits:
BaseAction
  • Object
show all
Defined in:
lib/procon_bypass_man/remote_action/remote_pbm_job/change_pbm_version_action.rb

Instance Attribute Summary

Attributes inherited from BaseAction

#pbm_job_uuid

Instance Method Summary collapse

Methods inherited from BaseAction

#initialize, #run!

Constructor Details

This class inherits a constructor from ProconBypassMan::RemoteAction::RemotePbmJob::BaseAction

Instance Method Details

#action_content(args:) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/procon_bypass_man/remote_action/remote_pbm_job/change_pbm_version_action.rb', line 6

def action_content(args: )
  require "pbmenv"
  ProconBypassMan.logger.info "execute ChangePbmVersionAction!"
  pbm_version = args["pbm_version"] or raise(ProconBypassMan::RemotePbmJob::NeedPbmVersionError, "pbm_versionが必要です, #{args.inspect}")
  Pbmenv.uninstall(pbm_version) # 途中でシャットダウンしてしまった、とか状態が途中の状態かもしれないので一旦消す
  Pbmenv.install(pbm_version, enable_pbm_cloud: true)
  Pbmenv.use(pbm_version)
  Pbmenv.clean(10)
  ProconBypassMan.logger.info "#{pbm_version}へアップグレードしました"
  ProconBypassMan::ReportCompletedUpgradePbmJob.perform
  `reboot` # symlinkの参照先が変わるのでrebootする必要がある
end