# Class Gitlab::Satellite::Action < Object

- lib/gitlab/satellite/action.rb

Methods

I
  - in_locked_and_timed_satellite
N
  - new
P
  - prepare_satellite!

Constants

DEFAULT_OPTIONS | = | { git_timeout: 30.seconds }

Attributes

[RW] | options |
[RW] | project |
[RW] | user |

Class Public methods
new(user, project, options = {}) Link

Source: show

    # File lib/gitlab/satellite/action.rb, line 8
    def initialize(user, project, options = {})
      @options = DEFAULT_OPTIONS.merge(options)
      @project = project
      @user = user
    end

Instance Protected methods
in_locked_and_timed_satellite() Link

- Sets a 30s timeout for Git

- Locks the satellite repo

- Yields the prepared satellite repo

Source: show

    # File lib/gitlab/satellite/action.rb, line 19
    def in_locked_and_timed_satellite
      Grit::Git.with_timeout(options[:git_timeout]) do
        project.satellite.lock do
          return yield project.satellite.repo
        end
      end
    rescue Errno::ENOMEM => ex
      Gitlab::GitLogger.error(ex.message)
      return false
    rescue Grit::Git::GitTimeout => ex
      Gitlab::GitLogger.error(ex.message)
      return false
    end

prepare_satellite!(repo) Link

- Clears the satellite

- Updates the satellite from Gitolite

- Sets up Git variables for the user

Note: use this within in_locked_and_timed_satellite

Source: show

    # File lib/gitlab/satellite/action.rb, line 38
    def prepare_satellite!(repo)
      project.satellite.clear_and_update!

      repo.git.config({}, "user.name", user.name)
      repo.git.config({}, "user.email", user.email)
    end