Class: Facter::Util::Aix::ODMQuery
- Inherits:
-
Object
- Object
- Facter::Util::Aix::ODMQuery
- Defined in:
- lib/facter/util/aix/odm_query.rb
Constant Summary collapse
- REPOS =
%w[CuAt CuDv PdAt PdDv].freeze
Instance Method Summary collapse
- #equals(field, value) ⇒ Object
- #execute ⇒ Object
-
#initialize ⇒ ODMQuery
constructor
A new instance of ODMQuery.
- #like(field, value) ⇒ Object
- #query ⇒ Object
Constructor Details
Instance Method Details
#equals(field, value) ⇒ Object
20 21 22 23 |
# File 'lib/facter/util/aix/odm_query.rb', line 20 def equals(field, value) @conditions << "#{field}='#{value}'" self end |
#execute ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/facter/util/aix/odm_query.rb', line 30 def execute result = nil REPOS.each do |repo| break if result && !result.empty? result = Facter::Core::Execution.execute("#{query} #{repo}", logger: @log) end result end |
#like(field, value) ⇒ Object
25 26 27 28 |
# File 'lib/facter/util/aix/odm_query.rb', line 25 def like(field, value) @conditions << "#{field} like '#{value}'" self end |
#query ⇒ Object
40 41 42 |
# File 'lib/facter/util/aix/odm_query.rb', line 40 def query 'odmget -q "' + @conditions.join(' AND ') + '"' end |