Class: Wright::Provider::User

Inherits:
Wright::Provider show all
Defined in:
lib/wright/provider/user.rb,
lib/wright/provider/user/gnu_passwd.rb,
lib/wright/provider/user/darwin_directory_service.rb

Overview

User provider. Used as a base class for Resource::User providers.

Direct Known Subclasses

DarwinDirectoryService, GnuPasswd

Defined Under Namespace

Classes: DarwinDirectoryService, GnuPasswd

Constant Summary

Constants inherited from Wright::Provider

PROVIDER_DIR

Instance Method Summary collapse

Methods inherited from Wright::Provider

#initialize, #updated?

Constructor Details

This class inherits a constructor from Wright::Provider

Instance Method Details

#createvoid

This method returns an undefined value.

Creates or updates the user.



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/wright/provider/user.rb', line 13

def create
  unless_uptodate(:create, "user already created: '#{user_name}'") do
    unless_dry_run("create user: '#{user_name}'") do
      if user_exists?
        update_user
      else
        create_user
      end
    end
  end
end

#removevoid

This method returns an undefined value.

Removes the user.



28
29
30
31
32
33
34
# File 'lib/wright/provider/user.rb', line 28

def remove
  unless_uptodate(:remove, "user already removed: '#{user_name}'") do
    unless_dry_run("remove user: '#{user_name}'") do
      remove_user
    end
  end
end