Class: PackerFiles::Core::User

Inherits:
Base
  • Object
show all
Defined in:
lib/PackerFiles/Core/User.rb

Overview

Define the User class that can handle User specified in a Packerfile. Just the barebones attributes that are required for this class are specified here. The conversion of these attributes into a OS build specific file is done by derived classes in the OS specific directories.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ User

Constructor to just specify accessor varibales

Yields:

  • (_self)

Yield Parameters:



29
30
31
32
# File 'lib/PackerFiles/Core/User.rb', line 29

def initialize
  @groups      = []
  yield self if block_given?
end

Instance Attribute Details

#groupsObject

Returns the value of attribute groups.



21
22
23
# File 'lib/PackerFiles/Core/User.rb', line 21

def groups
  @groups
end

#loginObject

Specify attributes



17
18
19
# File 'lib/PackerFiles/Core/User.rb', line 17

def 
  @login
end

#nameObject

Returns the value of attribute name.



18
19
20
# File 'lib/PackerFiles/Core/User.rb', line 18

def name
  @name
end

#passwordObject

Returns the value of attribute password.



19
20
21
# File 'lib/PackerFiles/Core/User.rb', line 19

def password
  @password
end

#uidObject

Returns the value of attribute uid.



20
21
22
# File 'lib/PackerFiles/Core/User.rb', line 20

def uid
  @uid
end

Class Method Details

.doc_fileObject

Documentation for this class



24
25
26
# File 'lib/PackerFiles/Core/User.rb', line 24

def self.doc_file
   PackerFiles.DirPath('Core/example/User.txt').first
end

Instance Method Details

#normalizeObject

Normalize the various values into something useful. The default implementation checks only errors

Raises:



36
37
38
39
40
# File 'lib/PackerFiles/Core/User.rb', line 36

def normalize
 raise NilException.new(self, 'login')    if @login.nil?
 raise NilException.new(self, 'name')     if @name.nil?
 raise NilException.new(self, 'password') if @password.nil?
end