hiera-simpledb 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -46,7 +46,7 @@ class Hiera
46
46
  # the array
47
47
  #
48
48
  # for priority searches we break after the first found data item
49
- new_answer = Backend.parse_answer(results, scope)
49
+ new_answer = type_conv(Backend.parse_answer(results, scope))
50
50
  case resolution_type
51
51
  when :array
52
52
  answer << new_answer
@@ -66,6 +66,22 @@ class Hiera
66
66
  answer = nil if answer == Backend.empty_answer(resolution_type)
67
67
  return answer
68
68
  end
69
+
70
+ # The simpledb aws-sdk returns attribute values as an array
71
+ # of values even if there is only one value. This normalizes the
72
+ # data type to a string if their are less than 2 array values.
73
+ def type_conv(results)
74
+ new_results = Hash.new
75
+ results.each do |k,v|
76
+ if v.size < 2
77
+ new_results[k] = v.to_s
78
+ else
79
+ new_results[k] = v
80
+ end
81
+ end
82
+ return new_results
83
+ end
84
+
69
85
  end
70
86
  end
71
87
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 2
9
- version: 0.0.2
8
+ - 3
9
+ version: 0.0.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Nathan Butler
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2012-04-10 00:00:00 -04:00
17
+ date: 2012-04-23 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -46,7 +46,7 @@ dependencies:
46
46
  type: :runtime
47
47
  version_requirements: *id002
48
48
  description: Hiera back end for retrieving configuration values from SimpleDB
49
- email: nathan.butler@newsweekdailybeast.com
49
+ email: nathan.butler@gmail.com
50
50
  executables: []
51
51
 
52
52
  extensions: []