Class: Redfish::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/redfish/context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(executor, install_dir, domain_name, domain_admin_port, domain_secure, domain_username, domain_password_file, options = {}) ⇒ Context

Returns a new instance of Context.



32
33
34
35
36
37
38
39
40
# File 'lib/redfish/context.rb', line 32

def initialize(executor, install_dir, domain_name, domain_admin_port, domain_secure, domain_username, domain_password_file, options = {})
  @executor, @install_dir, @domain_name, @domain_admin_port, @domain_secure, @domain_username, @domain_password_file =
    executor, install_dir, domain_name, domain_admin_port, domain_secure, domain_username, domain_password_file
  @echo = options[:echo].nil? ? false : !!options[:echo]
  @terse = options[:terse].nil? ? false : !!options[:terse]
  @system_user = options[:system_user]
  @system_group = options[:system_group]
  @property_cache = nil
end

Instance Attribute Details

#domain_admin_portObject (readonly)

The port on which the management application is bound.



9
10
11
# File 'lib/redfish/context.rb', line 9

def domain_admin_port
  @domain_admin_port
end

#domain_nameObject (readonly)

The name of the domain.



7
8
9
# File 'lib/redfish/context.rb', line 7

def domain_name
  @domain_name
end

#domain_password_fileObject (readonly)

The password file used when connecting to glassfish.



15
16
17
# File 'lib/redfish/context.rb', line 15

def domain_password_file
  @domain_password_file
end

#domain_secureObject (readonly)

If true use SSL when communicating with the domain for administration. Assumes the domain is in secure mode.



11
12
13
# File 'lib/redfish/context.rb', line 11

def domain_secure
  @domain_secure
end

#domain_usernameObject (readonly)

The username to use when communicating with the domain.



13
14
15
# File 'lib/redfish/context.rb', line 13

def domain_username
  @domain_username
end

#install_dirObject (readonly)

The directory in which glassfish has been installed.



4
5
6
# File 'lib/redfish/context.rb', line 4

def install_dir
  @install_dir
end

#system_groupObject (readonly)

The group that the asadmin command executes as.



30
31
32
# File 'lib/redfish/context.rb', line 30

def system_group
  @system_group
end

#system_userObject (readonly)

The user that the asadmin command executes as.



28
29
30
# File 'lib/redfish/context.rb', line 28

def system_user
  @system_user
end

Instance Method Details

#cache_properties(properties) ⇒ Object



51
52
53
54
# File 'lib/redfish/context.rb', line 51

def cache_properties(properties)
  raise 'Property cache already defined' if property_cache?
  @property_cache = PropertyCache.new(properties)
end

#echo?Boolean

If true, echo commands supplied to asadmin.

Returns:

  • (Boolean)


23
24
25
# File 'lib/redfish/context.rb', line 23

def echo?
  !!@echo
end

#exec(asadmin_command, args, options = {}) ⇒ Object



61
62
63
# File 'lib/redfish/context.rb', line 61

def exec(asadmin_command, args, options = {})
  @executor.exec(self, asadmin_command, args, options)
end

#property_cacheObject



46
47
48
49
# File 'lib/redfish/context.rb', line 46

def property_cache
  raise 'Property cache not defined' unless property_cache?
  @property_cache
end

#property_cache?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/redfish/context.rb', line 42

def property_cache?
  !@property_cache.nil?
end

#remove_property_cacheObject



56
57
58
59
# File 'lib/redfish/context.rb', line 56

def remove_property_cache
  raise 'No property cache to remove' unless property_cache?
  @property_cache = nil
end

#terse?Boolean

Use terse output from the underlying asadmin.

Returns:

  • (Boolean)


18
19
20
# File 'lib/redfish/context.rb', line 18

def terse?
  !!@terse
end