Sha256: 446d98e5120e9c5bb839e6027073a492cea5a550081858870100f0acc0928e9d

Contents?: true

Size: 1.09 KB

Versions: 8

Compression:

Stored size: 1.09 KB

Contents

module ProconBypassMan
  module RemoteAction
    module RemotePbmJob
      class ChangePbmVersionAction < BaseAction

        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

        private

        def before_action_callback
          be_processed
        end

        def after_action_callback
          # no-op
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
procon_bypass_man-0.3.12 lib/procon_bypass_man/remote_action/remote_pbm_job/change_pbm_version_action.rb
procon_bypass_man-0.3.11 lib/procon_bypass_man/remote_action/remote_pbm_job/change_pbm_version_action.rb
procon_bypass_man-0.3.10 lib/procon_bypass_man/remote_action/remote_pbm_job/change_pbm_version_action.rb
procon_bypass_man-0.3.9 lib/procon_bypass_man/remote_action/remote_pbm_job/change_pbm_version_action.rb
procon_bypass_man-0.3.8.1 lib/procon_bypass_man/remote_action/remote_pbm_job/change_pbm_version_action.rb
procon_bypass_man-0.3.8 lib/procon_bypass_man/remote_action/remote_pbm_job/change_pbm_version_action.rb
procon_bypass_man-0.3.7 lib/procon_bypass_man/remote_action/remote_pbm_job/change_pbm_version_action.rb
procon_bypass_man-0.3.6 lib/procon_bypass_man/remote_action/remote_pbm_job/change_pbm_version_action.rb