Module: PuppetX::EnterpriseModules::Oracle::Schemas

Defined in:
lib/puppet_x/enterprisemodules/oracle/schemas.rb

Overview

docs

Instance Method Summary collapse

Instance Method Details

#autoextend(value) ⇒ Object



101
102
103
104
105
106
107
108
# File 'lib/puppet_x/enterprisemodules/oracle/schemas.rb', line 101

def autoextend(value)
  entry = ['autoextend on']
  with_hash(value) do
    entry << content_if('next')
    entry << content_if('maxsize')
  end
  entry.compact.join(' ')
end

#datafiles(value) ⇒ Object



90
91
92
93
94
95
96
97
98
99
# File 'lib/puppet_x/enterprisemodules/oracle/schemas.rb', line 90

def datafiles(value)
  value = [value] unless value.is_a?(Array) # values can be either a Hash or an Array
  value.collect do |v|
    entry = []
    with_hash(v) do
      entry << file_specification(v)
    end
    entry.compact.join(' ')
  end.compact.join(', ')
end

#extent_management(value) ⇒ Object



110
111
112
113
114
115
116
117
118
# File 'lib/puppet_x/enterprisemodules/oracle/schemas.rb', line 110

def extent_management(value)
  return_value = []
  with_hash(value) do
    return_value << "extent management #{value_for('type')}"
    return_value << key_if('autoallocate')
    return_value << content_if('uniform_size')
  end
  return_value.compact.join(' ')
end

#file_characteristics(value) ⇒ Object



81
82
83
84
85
86
87
88
# File 'lib/puppet_x/enterprisemodules/oracle/schemas.rb', line 81

def file_characteristics(value)
  entry = []
  with_hash(value) do
    entry << content_if('size')
    entry << key_if('reuse')
  end
  entry.join(' ')
end

#file_specification(value) ⇒ Object



69
70
71
72
73
74
75
76
77
78
79
# File 'lib/puppet_x/enterprisemodules/oracle/schemas.rb', line 69

def file_specification(value)
  entry = []
  with_hash(value) do
    autoextend_value = value_for('autoextend')
    entry << "'#{value_for('file_name')}'" if value_for('file_name')
    entry << content_if('size')
    entry << key_if('reuse')
    entry << autoextend(autoextend_value).to_s if exists?('autoextend')
  end
  entry.join(' ')
end

#validate_extent_management(value) ⇒ Object



57
58
59
60
61
62
63
64
65
66
67
# File 'lib/puppet_x/enterprisemodules/oracle/schemas.rb', line 57

def validate_extent_management(value)
  # rubocop:disable Style/GuardClause
  if value
    # rubocop:enable Style/GuardClause
    with_hash(value) do
      type = value_for('type')
      raise ArgumentError, 'extent management dictionary, incompatible with autoallocate' if type.casecmp('dictionary').zero? && exists?('autoallocate')
      raise ArgumentError, 'extent management dictionary, incompatible with uniform_size' if type.casecmp('dictionary').zero? && exists?('uniform_size')
    end
  end
end