rubocop:disable Security/MarshalLoad
176913
def on(hosts, options={}, &block)
      subset_copy = Marshal.dump(Configuration.env.filter(hosts))
      SSHKit::Coordinator.new(Marshal.load(subset_copy)).each(options, &block)
    end
1297991
def [](*args)
      if args.first.kind_of?(Hash) || args.first.kind_of?(Ldaptic::DN)
        send(:/, *args)
      else
        super
      end
    end
592377
def load_yaml_configuration
      yaml_config = YAML.load_file("#{@rails_root_dir}/config/chronuscop.yml")
      @redis_db_number = yaml_config[@rails_environment]['redis_db_number']
      @redis_server_port = yaml_config[@rails_environment]['redis_server_port']
      @project_number = yaml_config[@rails_environment]['project_number']
      @api_token = yaml_config[@rails_environment]['api_token']
      @chronuscop_server_address = yaml_config[@rails_environment]['chronuscop_server_address']
      @sync_time_interval = yaml_config[@rails_environment]['sync_time_interval']
    end
1098582
def delete!(force = false)
      if local?
        @lib.branch(@name, :force => force, :delete => true)
      else
        @lib.push(Process.server_name, nil, nil, :delete => @name)
      end
    end
567941
def method_missing(meth, *args, &block)
      if meth.to_s =~ /\=$/
        key_name = meth.to_s.gsub(/\=$/,"")
        raise DoesFacebook::ConfigurationError.new("Unknown configuration key `#{key_name}` cannot be set for Facebook applications.")
      end
      super
    end
1174954
def rack_options # :nodoc:
      symbolized_options(:port, :host, :server, :daemonize, :pid).tap do |rack_options|
        rack_options[:environment] = environment
        rack_options[:Port] = rack_options.delete :port
        rack_options[:Host] = rack_options.delete :host
        rack_options[:app] = machined
      end
    end
1019557
def start
      setup_signal_handlers
      @server = WEBrick::HTTPServer.new(options)
      @server.mount '/', Rack::Handler::WEBrick, app
      @server.start
    end
623710
def error_block!(key, *block_params)
      base = settings
      while base.respond_to?(:errors)
        next base = base.superclass unless args_array = base.errors[key]
        args_array.reverse_each do |args|
          first = args == args_array.first
          args += [block_params]
          resp = process_route(*args)
          return resp unless resp.nil? && !first
        end
      end
      return false unless key.respond_to? :superclass and key.superclass < Exception
      error_block!(key.superclass, *block_params)
    end
261945
def destroy
      # TODO: resolve the fact that there may be more than one for the same
      # provider.  either disallow multiple, or select the correct one.
      auth = Corkboard::Authorization.find_by_provider(params[:provider])
      auth.destroy if auth
      Corkboard.clear_all!

      redirect_to(authorizations_path)
    end
498686
def load!(path)
      settings = YAML.safe_load(ERB.new(File.new(path).read).result)['api']
      from_hash(settings) if settings.is_a? Hash
    end
273845
def deployed_by
      username = nil

      scm = fetch(:scm, nil)

      if scm
        if scm.to_sym == :git
          username = `git config user.name`.chomp
          username = nil if $? != 0 || username.strip == ''
        end
      end

      username || `whoami`.chomp
    end
790233
def start!
      Sudo::System.check

      @sudo_pid = spawn(
"#{SUDO_CMD} -E #{RUBY_CMD} -I#{LIBDIR} #{@ruby_opts} #{SERVER_SCRIPT} #{@socket} #{Process.uid}"
      )
      Process.detach(@sudo_pid) if @sudo_pid # avoid zombies
      finalizer = Finalizer.new(pid: @sudo_pid, socket: @socket)
      ObjectSpace.define_finalizer(self, finalizer)

      if wait_for(timeout: 1){File.exists? @socket}
        @proxy = DRbObject.new_with_uri(server_uri)
      else
        raise RuntimeError, "Couldn't create DRb socket #{@socket}"
      end

      load!

      self
    end
250121
def save # rubocop:disable Metrics/AbcSize
      body = { version: to_hash }

      # providers are saved seperately
      body[:version].delete(:providers)

      begin
        response = Atlas.client.put(url_builder.box_version_url, body: body)
      rescue Atlas::Errors::NotFoundError
        response = Atlas.client.post("#{url_builder.box_url}/versions",
                                     body: body)
      end

      # trigger the same on the providers
      providers.each(&:save) if providers

      update_with_response(response, [:providers])
    end
1046326
def permitted_to! (privilege, object_or_sym = nil, options = {})
      authorization_engine.permit!(privilege, options_for_permit(object_or_sym, options, true))
    end
545199
def call(*, **, &block)
      pid = fork_and_return_pid(&block)
      write.close
      result = read.read
      Process.wait(pid)

      # rubocop:disable MarshalLoad
      Marshal.load(result)
      # rubocop:enable MarshalLoad
    end
1161030
def method_missing(meth, *args, &block)
      raise NoMethodError, "undefined method #{meth} for #{self.class.to_s}" if WotApiRu::Constants::PATH[meth.to_sym].nil?
      options = args[0] || {}
      options[:application_id] ||= WotApiRu::Settings[:application_id]
      path = WotApiRu::Constants::HOST + WotApiRu::Constants::PATH[meth.to_sym]
      invoke(path, options)
    end
27058
def request(op, *args)
      verify_state
      raise Dalli::NetworkError, "#{name} is down: #{@error} #{@msg}. If you are sure it is running, ensure memcached version is > 1.4." unless alive?
      begin
        send(op, *args)
      rescue Dalli::MarshalError => ex
        Dalli.logger.error "Marshalling error for key '#{args.first}': #{ex.message}"
        Dalli.logger.error "You are trying to cache a Ruby object which cannot be serialized to memcached."
        Dalli.logger.error ex.backtrace.join("\n\t")
        false
      rescue Dalli::DalliError, Dalli::NetworkError, Dalli::ValueOverMaxSize, Timeout::Error
        raise
      rescue => ex
        Dalli.logger.error "Unexpected exception during Dalli request: #{ex.class.name}: #{ex.message}"
        Dalli.logger.error ex.backtrace.join("\n\t")
        down!
      end
    end