Sha256: 5af76e6a6f716dcb00709ced545b986b6d49d7fb776e1fb91cb36295b23c7041

Contents?: true

Size: 1020 Bytes

Versions: 26

Compression:

Stored size: 1020 Bytes

Contents

class Specinfra::Command::Base::User < Specinfra::Command::Base
  class << self
    def check_exists(user)
      "id #{escape(user)}"
    end

    def check_belongs_to_group(user, group)
      "id #{escape(user)} | awk '{print $3}' | grep -- #{escape(group)}"
    end

    def check_belongs_to_primary_group(user, group)
      "id -gn #{escape(user)}| grep ^#{escape(group)}$"
    end

    def check_has_uid(user, uid)
      regexp = "^uid=#{uid}("
      "id #{escape(user)} | grep -- #{escape(regexp)}"
    end

    def check_has_home_directory(user, path_to_home)
      "getent passwd #{escape(user)} | cut -f 6 -d ':' | grep -w -- #{escape(path_to_home)}"
    end

    def check_has_login_shell(user, path_to_shell)
      "getent passwd #{escape(user)} | cut -f 7 -d ':' | grep -w -- #{escape(path_to_shell)}"
    end

    def check_has_authorized_key(user, key)
      key.sub!(/\s+\S*$/, '') if key.match(/^\S+\s+\S+\s+\S*$/)
      "grep -w -- #{escape(key)} ~#{escape(user)}/.ssh/authorized_keys"
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
specinfra-2.0.0.beta41 lib/specinfra/command/base/user.rb
specinfra-2.0.0.beta40 lib/specinfra/command/base/user.rb
specinfra-2.0.0.beta39 lib/specinfra/command/base/user.rb
specinfra-2.0.0.beta38 lib/specinfra/command/base/user.rb
specinfra-2.0.0.beta37 lib/specinfra/command/base/user.rb
specinfra-2.0.0.beta36 lib/specinfra/command/base/user.rb
specinfra-2.0.0.beta35 lib/specinfra/command/base/user.rb
specinfra-2.0.0.beta34 lib/specinfra/command/base/user.rb
specinfra-2.0.0.beta33 lib/specinfra/command/base/user.rb
specinfra-2.0.0.beta32 lib/specinfra/command/base/user.rb
specinfra-2.0.0.beta31 lib/specinfra/command/base/user.rb
specinfra-2.0.0.beta30 lib/specinfra/command/base/user.rb
specinfra-2.0.0.beta29 lib/specinfra/command/base/user.rb
specinfra-2.0.0.beta28 lib/specinfra/command/base/user.rb
specinfra-2.0.0.beta27 lib/specinfra/command/base/user.rb
specinfra-2.0.0.beta26 lib/specinfra/command/base/user.rb
specinfra-2.0.0.beta25 lib/specinfra/command/base/user.rb
specinfra-2.0.0.beta24 lib/specinfra/command/base/user.rb
specinfra-2.0.0.beta23 lib/specinfra/command/base/user.rb
specinfra-2.0.0.beta22 lib/specinfra/command/base/user.rb