Sha256: 27e75663abacdd71fe5319893d06180978bb0abf7f78704ab8822a629bf03d04

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

module ProconBypassMan
  module RemotePbmAction
    class ChangePbmVersionAction < BaseAction

      def action_content(args: )
        require "pbmenv"
        ProconBypassMan.logger.info "execute ChangePbmVersionAction!"
        pbm_version = args["pbm_version"] or raise(ProconBypassMan::RemotePbmAction::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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
procon_bypass_man-0.3.5 lib/procon_bypass_man/remote_pbm_action/change_pbm_version_action.rb