You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: lifecycle_hook_manager.rb
    path of file: ./repos/kontena/agent/lib/kontena/service_pods
    
    the code of the file until where you have to start completion: require 'securerandom'

module Kontena
  module ServicePods
    class LifecycleHookManager
      include Kontena::Helpers::RpcHelper
      include Common

      attr_reader :node, :service_pod

      def initialize(node)
        @
    
      def on_pre_start
        pre_start_hooks = hooks_for('pre_start')
        return if pre_start_hooks.size == 0

        pre_start_hooks.each do |hook|
          begin
            info "running pre_start hook: #{hook['cmd']}"
            service_config = config_container(service_pod.dup, hook['cmd'])
            service_config['name'] = "#{service_config['name']}-#{SecureRandom.urlsafe_base64(5)}"
            service_container = create_container(service_config)
            log_hook_output(service_container.id, "running pre_start hook: #{hook['cmd']}", 'stdout')
            service_container.tap(&:start).attach
            if service_container.state['ExitCode'] != 0
              raise "Failed to execute pre_start hook: #{hook['cmd']}, exit code: #{service_container.state['ExitCode']}"
            end
          ensure
            cleanup_container(service_container) if service_container
          end