octopus-serverspec-extensions 0.17.1 → 0.19.0

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.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +14 -14
  3. data/.rspec +2 -2
  4. data/.travis.yml +5 -5
  5. data/Gemfile +4 -4
  6. data/LICENSE.txt +12 -12
  7. data/README.md +39 -39
  8. data/Rakefile +6 -6
  9. data/bin/console +14 -14
  10. data/bin/setup +8 -8
  11. data/docs/authentication.md +45 -45
  12. data/docs/octopus_deploy_account.md +37 -37
  13. data/docs/octopus_deploy_doc_template.md +16 -16
  14. data/docs/octopus_deploy_environment.md +32 -32
  15. data/docs/octopus_deploy_project_group.md +30 -30
  16. data/docs/octopus_deploy_smtp_config.md +39 -39
  17. data/docs/octopus_deploy_space.md +32 -32
  18. data/docs/octopus_deploy_team.md +25 -25
  19. data/docs/octopus_deploy_tentacle.md +40 -40
  20. data/docs/octopus_deploy_upgrade_config.md +33 -33
  21. data/docs/octopus_deploy_user.md +33 -33
  22. data/docs/octopus_deploy_worker.md +38 -38
  23. data/docs/octopus_deploy_worker_pool.md +25 -25
  24. data/lib/octopus_serverspec_extensions.rb +85 -85
  25. data/lib/octopus_serverspec_extensions/matcher/allow_dynamic_infrastructure.rb +12 -12
  26. data/lib/octopus_serverspec_extensions/matcher/have_linux_line_endings.rb +13 -13
  27. data/lib/octopus_serverspec_extensions/matcher/have_version.rb +36 -36
  28. data/lib/octopus_serverspec_extensions/matcher/have_windows_line_endings.rb +13 -13
  29. data/lib/octopus_serverspec_extensions/matcher/run_under_account.rb +17 -17
  30. data/lib/octopus_serverspec_extensions/matcher/use_guided_failure.rb +12 -12
  31. data/lib/octopus_serverspec_extensions/type/chocolatey_package.rb +33 -33
  32. data/lib/octopus_serverspec_extensions/type/java_property_file.rb +28 -28
  33. data/lib/octopus_serverspec_extensions/type/npm_package.rb +36 -36
  34. data/lib/octopus_serverspec_extensions/type/octopus_deploy_account.rb +176 -176
  35. data/lib/octopus_serverspec_extensions/type/octopus_deploy_environment.rb +117 -117
  36. data/lib/octopus_serverspec_extensions/type/octopus_deploy_project_group.rb +127 -127
  37. data/lib/octopus_serverspec_extensions/type/octopus_deploy_smtp_config.rb +109 -109
  38. data/lib/octopus_serverspec_extensions/type/octopus_deploy_space.rb +92 -92
  39. data/lib/octopus_serverspec_extensions/type/octopus_deploy_team.rb +81 -81
  40. data/lib/octopus_serverspec_extensions/type/octopus_deploy_tentacle.rb +208 -208
  41. data/lib/octopus_serverspec_extensions/type/octopus_deploy_upgrade_config.rb +112 -112
  42. data/lib/octopus_serverspec_extensions/type/octopus_deploy_user.rb +110 -110
  43. data/lib/octopus_serverspec_extensions/type/octopus_deploy_worker.rb +173 -173
  44. data/lib/octopus_serverspec_extensions/type/octopus_deploy_worker_pool.rb +88 -88
  45. data/lib/octopus_serverspec_extensions/type/windows_dsc.rb +37 -32
  46. data/lib/octopus_serverspec_extensions/type/windows_firewall.rb +32 -32
  47. data/lib/octopus_serverspec_extensions/type/windows_scheduled_task.rb +33 -33
  48. data/lib/octopus_serverspec_extensions/version.rb +3 -3
  49. data/octopus-serverspec-extensions.gemspec +34 -34
  50. metadata +17 -18
@@ -1,17 +1,17 @@
1
- RSpec::Matchers.define :run_under_account do |account_name|
2
- match do |service|
3
- @runner = Specinfra::Runner
4
- command_result = @runner.run_command("$ProgressPreference = 'SilentlyContinue'; (Get-WmiObject Win32_Service | Where-Object {$_.Name -eq '#{service.name}'}).StartName -eq '#{account_name}'")
5
- command_result.stdout.strip == 'True'
6
- end
7
-
8
- failure_message do |service|
9
- command_result = @runner.run_command("$ProgressPreference = 'SilentlyContinue'; (Get-WmiObject Win32_Service | Where-Object {$_.Name -eq '#{service.name}'}).StartName")
10
- "Expected service '#{service.name}' to be running under '#{account_name}' but was running under '#{command_result.stdout.strip}'"
11
- end
12
-
13
- failure_message_when_negated do |service|
14
- command_result = @runner.run_command("$ProgressPreference = 'SilentlyContinue'; (Get-WmiObject Win32_Service | Where-Object {$_.Name -eq '#{service.name}'}).StartName")
15
- "Expected service '#{service.name}' to not be running under '#{account_name}' but was running under '#{command_result.stdout.strip}'"
16
- end
17
- end
1
+ RSpec::Matchers.define :run_under_account do |account_name|
2
+ match do |service|
3
+ @runner = Specinfra::Runner
4
+ command_result = @runner.run_command("$ProgressPreference = 'SilentlyContinue'; (Get-WmiObject Win32_Service | Where-Object {$_.Name -eq '#{service.name}'}).StartName -eq '#{account_name}'")
5
+ command_result.stdout.strip == 'True'
6
+ end
7
+
8
+ failure_message do |service|
9
+ command_result = @runner.run_command("$ProgressPreference = 'SilentlyContinue'; (Get-WmiObject Win32_Service | Where-Object {$_.Name -eq '#{service.name}'}).StartName")
10
+ "Expected service '#{service.name}' to be running under '#{account_name}' but was running under '#{command_result.stdout.strip}'"
11
+ end
12
+
13
+ failure_message_when_negated do |service|
14
+ command_result = @runner.run_command("$ProgressPreference = 'SilentlyContinue'; (Get-WmiObject Win32_Service | Where-Object {$_.Name -eq '#{service.name}'}).StartName")
15
+ "Expected service '#{service.name}' to not be running under '#{account_name}' but was running under '#{command_result.stdout.strip}'"
16
+ end
17
+ end
@@ -1,13 +1,13 @@
1
- RSpec::Matchers.define :use_guided_failure do
2
- match do |env|
3
- env.use_guided_failure? == true
4
- end
5
-
6
- failure_message do |env|
7
- "Expected Environment '#{env.environment_name}' to use guided failure mode, but it didn't"
8
- end
9
-
10
- failure_message_when_negated do |env|
11
- "Expected Environment '#{env.environment_name}' not to use guided failure mode, but it did"
12
- end
1
+ RSpec::Matchers.define :use_guided_failure do
2
+ match do |env|
3
+ env.use_guided_failure? == true
4
+ end
5
+
6
+ failure_message do |env|
7
+ "Expected Environment '#{env.environment_name}' to use guided failure mode, but it didn't"
8
+ end
9
+
10
+ failure_message_when_negated do |env|
11
+ "Expected Environment '#{env.environment_name}' not to use guided failure mode, but it did"
12
+ end
13
13
  end
@@ -1,34 +1,34 @@
1
- require 'serverspec'
2
- require 'serverspec/type/base'
3
-
4
- module Serverspec::Type
5
- class ChocolateyPackage < Base
6
-
7
- def initialize(name)
8
- @name = name
9
- @runner = Specinfra::Runner
10
- end
11
-
12
- def installed?(provider, version)
13
- command_result = @runner.run_command("choco list -l -r #{name}")
14
-
15
- software = command_result.stdout.gsub("\r\n", "\n").split("\n").each_with_object({}) do |s, h|
16
- v, k = s.split('|')
17
- h[String(v).strip.downcase] = String(k).strip.downcase
18
- h
19
- end
20
-
21
- if (version.nil?)
22
- !software[name.downcase].nil?
23
- else
24
- software[name.downcase] == version
25
- end
26
- end
27
- end
28
-
29
- def chocolatey_package(name)
30
- ChocolateyPackage.new(name)
31
- end
32
- end
33
-
1
+ require 'serverspec'
2
+ require 'serverspec/type/base'
3
+
4
+ module Serverspec::Type
5
+ class ChocolateyPackage < Base
6
+
7
+ def initialize(name)
8
+ @name = name
9
+ @runner = Specinfra::Runner
10
+ end
11
+
12
+ def installed?(provider, version)
13
+ command_result = @runner.run_command("choco list -l -r #{name}")
14
+
15
+ software = command_result.stdout.gsub("\r\n", "\n").split("\n").each_with_object({}) do |s, h|
16
+ v, k = s.split('|')
17
+ h[String(v).strip.downcase] = String(k).strip.downcase
18
+ h
19
+ end
20
+
21
+ if (version.nil?)
22
+ !software[name.downcase].nil?
23
+ else
24
+ software[name.downcase] == version
25
+ end
26
+ end
27
+ end
28
+
29
+ def chocolatey_package(name)
30
+ ChocolateyPackage.new(name)
31
+ end
32
+ end
33
+
34
34
  include Serverspec::Type
@@ -1,29 +1,29 @@
1
- require 'serverspec'
2
- require 'serverspec/type/base'
3
-
4
- module Serverspec::Type
5
- class JavaPropertyFile < Base
6
-
7
- def initialize(name)
8
- @name = name
9
- @runner = Specinfra::Runner
10
- end
11
-
12
- def has_property?(propertyName, propertyValue)
13
- properties = {}
14
- IO.foreach(@name) do |line|
15
- if (!line.start_with?('#'))
16
- properties[$1.strip] = $2 if line =~ /([^=]*)=(.*)/
17
- end
18
- end
19
-
20
- properties[propertyName] == propertyValue
21
- end
22
- end
23
-
24
- def java_property_file(name)
25
- JavaPropertyFile.new(name)
26
- end
27
- end
28
-
1
+ require 'serverspec'
2
+ require 'serverspec/type/base'
3
+
4
+ module Serverspec::Type
5
+ class JavaPropertyFile < Base
6
+
7
+ def initialize(name)
8
+ @name = name
9
+ @runner = Specinfra::Runner
10
+ end
11
+
12
+ def has_property?(propertyName, propertyValue)
13
+ properties = {}
14
+ IO.foreach(@name) do |line|
15
+ if (!line.start_with?('#'))
16
+ properties[$1.strip] = $2 if line =~ /([^=]*)=(.*)/
17
+ end
18
+ end
19
+
20
+ properties[propertyName] == propertyValue
21
+ end
22
+ end
23
+
24
+ def java_property_file(name)
25
+ JavaPropertyFile.new(name)
26
+ end
27
+ end
28
+
29
29
  include Serverspec::Type
@@ -1,37 +1,37 @@
1
- require 'serverspec'
2
- require 'serverspec/type/base'
3
-
4
- module Serverspec::Type
5
- class NpmPackage < Base
6
-
7
- def initialize(name)
8
- @name = name
9
- @runner = Specinfra::Runner
10
- end
11
-
12
- def installed?(provider, version)
13
- command_result = @runner.run_command("npm list -g #{name}")
14
-
15
- software = command_result.stdout.split("\n").each_with_object({}) do |s, h|
16
- if s.include? "@"
17
- package_name, package_version = s.split('@')
18
- package_name = package_name.gsub(/.*? /, '')
19
- h[String(package_name).strip.downcase] = String(package_version).strip.downcase
20
- end
21
- h
22
- end
23
-
24
- if (version.nil?)
25
- !software[name.downcase].nil?
26
- else
27
- software[name.downcase] == version
28
- end
29
- end
30
- end
31
-
32
- def npm_package(name)
33
- NpmPackage.new(name)
34
- end
35
- end
36
-
1
+ require 'serverspec'
2
+ require 'serverspec/type/base'
3
+
4
+ module Serverspec::Type
5
+ class NpmPackage < Base
6
+
7
+ def initialize(name)
8
+ @name = name
9
+ @runner = Specinfra::Runner
10
+ end
11
+
12
+ def installed?(provider, version)
13
+ command_result = @runner.run_command("npm list -g #{name}")
14
+
15
+ software = command_result.stdout.split("\n").each_with_object({}) do |s, h|
16
+ if s.include? "@"
17
+ package_name, package_version = s.split('@')
18
+ package_name = package_name.gsub(/.*? /, '')
19
+ h[String(package_name).strip.downcase] = String(package_version).strip.downcase
20
+ end
21
+ h
22
+ end
23
+
24
+ if (version.nil?)
25
+ !software[name.downcase].nil?
26
+ else
27
+ software[name.downcase] == version
28
+ end
29
+ end
30
+ end
31
+
32
+ def npm_package(name)
33
+ NpmPackage.new(name)
34
+ end
35
+ end
36
+
37
37
  include Serverspec::Type
@@ -1,176 +1,176 @@
1
- require 'serverspec'
2
- require 'serverspec/type/base'
3
- require 'net/http'
4
- require 'json'
5
-
6
- module Serverspec::Type
7
- class OctopusDeployAccount < Base
8
- @account = nil
9
- @accountName = nil
10
- @serverUrl = nil
11
- @apiKey = nil
12
- @serverSupportsSpaces = nil
13
- @spaceId = nil
14
- @spaceFragment = ""
15
-
16
- # constants for account types
17
- AZURE = 'AzureSubscription'.freeze
18
- AWS = 'AmazonWebServicesAccount'.freeze
19
- SSH = 'SshKeypair'.freeze
20
- TOKEN = 'Token'.freeze
21
- USERNAME = 'UsernamePassword'.freeze
22
- ACCOUNT_TYPES = [AZURE, AWS, SSH, TOKEN, USERNAME]
23
-
24
- def initialize(*url_and_api_key, account_name)
25
- server_url, api_key = get_octopus_creds(url_and_api_key)
26
-
27
- @serverSupportsSpaces = check_supports_spaces(server_url)
28
-
29
- @name = "Octopus Deploy Account #{account_name}"
30
- @runner = Specinfra::Runner
31
- @accountName = account_name
32
- @serverUrl = server_url
33
- @apiKey = api_key
34
-
35
- if account_name.nil? or account_name == ""
36
- raise "'account_name' was not provided. Unable to connect to Octopus server to validate configuration."
37
- end
38
- end
39
-
40
- def exists?
41
- load_resource_if_nil()
42
- (!@account.nil?) && (@account != [])
43
- end
44
-
45
- def has_description?(account_description)
46
- load_resource_if_nil()
47
- return false if @account.nil?
48
- @account["Description"] == account_description
49
- end
50
-
51
- def account_type?(account_type_name)
52
- load_resource_if_nil()
53
- if !ACCOUNT_TYPES.include? account_type_name
54
- raise("'#{account_type_name}' is not a valid account type")
55
- end
56
- return false if @account.nil?
57
-
58
- @account["AccountType"] == account_type_name
59
- end
60
-
61
- def azure_account?
62
- return false if @account.nil?
63
- account_type?(AZURE)
64
- # should also have a subscription number, but Octopus manages validation on this
65
- end
66
-
67
- def aws_account?
68
- return false if @account.nil?
69
- account_type?(AWS)
70
- end
71
-
72
- def ssh_key_pair?
73
- return false if @account.nil?
74
- account_type?(SSH)
75
- end
76
-
77
- def username_password?
78
- return false if @account.nil?
79
- account_type?(USERNAME)
80
- end
81
-
82
- def token?
83
- return false if @account.nil?
84
- account_type?(TOKEN)
85
- end
86
-
87
- def in_environment?(environment_name)
88
- load_resource_if_nil()
89
- return false if @account.nil?
90
- url = "#{@serverUrl}/api/#{@spaceFragment}environments/all?api-key=#{@apiKey}"
91
- resp = Net::HTTP.get_response(URI.parse(url))
92
- environments = JSON.parse(resp.body)
93
- environment_id = environments.select {|e| e["Name"] == environment_name}.first["Id"]
94
- !@account["EnvironmentIds"].select {|e| e == environment_id}.empty?
95
- end
96
-
97
- def has_tenanted_deployment_participation?(mode)
98
- load_resource_if_nil()
99
- return false if @machine.nil?
100
- @machine["TenantedDeploymentParticipation"] == mode # copied directly from tentacle
101
- end
102
-
103
- def has_property?(property_name, expected_value)
104
- load_resource_if_nil()
105
- return false if @account.nil?
106
- @account[property_name] == expected_value
107
- end
108
-
109
- def in_space(space_name)
110
- # allows us to tag .in_space() onto the end of the resource. as in
111
- # describe octopus_account("account name").in_space("MyNewSpace") do
112
- @spaceId = get_space_id?(space_name)
113
- if @accountName.nil?
114
- raise "'account_name' was not provided. Please provide an account name and try again."
115
- end
116
- self
117
- end
118
-
119
- private
120
-
121
- def load_resource_if_nil
122
- if @account.nil?
123
- @account = get_account_via_api(@serverUrl, @apiKey, @accountName)
124
- end
125
- end
126
-
127
- def get_space_id?(space_name)
128
- return false if @serverSupportsSpaces.nil?
129
- url = "#{@serverUrl}/api/Spaces/all?api-key=#{@apiKey}"
130
- resp = Net::HTTP.get_response(URI.parse(url))
131
- spaces = JSON.parse(resp.body)
132
- space_id = spaces.select {|e| e["Name"] == space_name}.first["Id"]
133
- space_id
134
- end
135
-
136
- end
137
-
138
- def octopus_deploy_account(*url_and_api_key, account_name)
139
- serverUrl, apiKey = get_octopus_creds(url_and_api_key)
140
-
141
- OctopusDeployAccount.new(serverUrl, apiKey, account_name)
142
- end
143
-
144
- def octopus_account(*url_and_api_key, account_name)
145
- serverUrl, apiKey = get_octopus_creds(url_and_api_key)
146
-
147
- OctopusDeployAccount.new(serverUrl, apiKey, account_name)
148
- end
149
-
150
- private
151
-
152
- def get_account_via_api(serverUrl, apiKey, account_name)
153
- account = nil
154
-
155
- unless @spaceId.nil?
156
- # set the spaceId correctly
157
- @spaceFragment = "#{@spaceId}/"
158
- end
159
-
160
- url = "#{serverUrl}/api/#{@spaceFragment}accounts/all?api-key=#{apiKey}"
161
-
162
- begin
163
- resp = Net::HTTP.get_response(URI.parse(url))
164
- body = JSON.parse(resp.body)
165
- account = body.select {|i| i['Name'] == account_name }.first unless body.nil?
166
- rescue => e
167
- raise "get_account_via_api: Unable to connect to #{url}: #{e}"
168
- end
169
-
170
- account
171
- end
172
-
173
-
174
- end
175
-
176
- include Serverspec::Type
1
+ require 'serverspec'
2
+ require 'serverspec/type/base'
3
+ require 'net/http'
4
+ require 'json'
5
+
6
+ module Serverspec::Type
7
+ class OctopusDeployAccount < Base
8
+ @account = nil
9
+ @accountName = nil
10
+ @serverUrl = nil
11
+ @apiKey = nil
12
+ @serverSupportsSpaces = nil
13
+ @spaceId = nil
14
+ @spaceFragment = ""
15
+
16
+ # constants for account types
17
+ AZURE = 'AzureSubscription'.freeze
18
+ AWS = 'AmazonWebServicesAccount'.freeze
19
+ SSH = 'SshKeypair'.freeze
20
+ TOKEN = 'Token'.freeze
21
+ USERNAME = 'UsernamePassword'.freeze
22
+ ACCOUNT_TYPES = [AZURE, AWS, SSH, TOKEN, USERNAME]
23
+
24
+ def initialize(*url_and_api_key, account_name)
25
+ server_url, api_key = get_octopus_creds(url_and_api_key)
26
+
27
+ @serverSupportsSpaces = check_supports_spaces(server_url)
28
+
29
+ @name = "Octopus Deploy Account #{account_name}"
30
+ @runner = Specinfra::Runner
31
+ @accountName = account_name
32
+ @serverUrl = server_url
33
+ @apiKey = api_key
34
+
35
+ if account_name.nil? or account_name == ""
36
+ raise "'account_name' was not provided. Unable to connect to Octopus server to validate configuration."
37
+ end
38
+ end
39
+
40
+ def exists?
41
+ load_resource_if_nil()
42
+ (!@account.nil?) && (@account != [])
43
+ end
44
+
45
+ def has_description?(account_description)
46
+ load_resource_if_nil()
47
+ return false if @account.nil?
48
+ @account["Description"] == account_description
49
+ end
50
+
51
+ def account_type?(account_type_name)
52
+ load_resource_if_nil()
53
+ if !ACCOUNT_TYPES.include? account_type_name
54
+ raise("'#{account_type_name}' is not a valid account type")
55
+ end
56
+ return false if @account.nil?
57
+
58
+ @account["AccountType"] == account_type_name
59
+ end
60
+
61
+ def azure_account?
62
+ return false if @account.nil?
63
+ account_type?(AZURE)
64
+ # should also have a subscription number, but Octopus manages validation on this
65
+ end
66
+
67
+ def aws_account?
68
+ return false if @account.nil?
69
+ account_type?(AWS)
70
+ end
71
+
72
+ def ssh_key_pair?
73
+ return false if @account.nil?
74
+ account_type?(SSH)
75
+ end
76
+
77
+ def username_password?
78
+ return false if @account.nil?
79
+ account_type?(USERNAME)
80
+ end
81
+
82
+ def token?
83
+ return false if @account.nil?
84
+ account_type?(TOKEN)
85
+ end
86
+
87
+ def in_environment?(environment_name)
88
+ load_resource_if_nil()
89
+ return false if @account.nil?
90
+ url = "#{@serverUrl}/api/#{@spaceFragment}environments/all?api-key=#{@apiKey}"
91
+ resp = Net::HTTP.get_response(URI.parse(url))
92
+ environments = JSON.parse(resp.body)
93
+ environment_id = environments.select {|e| e["Name"] == environment_name}.first["Id"]
94
+ !@account["EnvironmentIds"].select {|e| e == environment_id}.empty?
95
+ end
96
+
97
+ def has_tenanted_deployment_participation?(mode)
98
+ load_resource_if_nil()
99
+ return false if @machine.nil?
100
+ @machine["TenantedDeploymentParticipation"] == mode # copied directly from tentacle
101
+ end
102
+
103
+ def has_property?(property_name, expected_value)
104
+ load_resource_if_nil()
105
+ return false if @account.nil?
106
+ @account[property_name] == expected_value
107
+ end
108
+
109
+ def in_space(space_name)
110
+ # allows us to tag .in_space() onto the end of the resource. as in
111
+ # describe octopus_account("account name").in_space("MyNewSpace") do
112
+ @spaceId = get_space_id?(space_name)
113
+ if @accountName.nil?
114
+ raise "'account_name' was not provided. Please provide an account name and try again."
115
+ end
116
+ self
117
+ end
118
+
119
+ private
120
+
121
+ def load_resource_if_nil
122
+ if @account.nil?
123
+ @account = get_account_via_api(@serverUrl, @apiKey, @accountName)
124
+ end
125
+ end
126
+
127
+ def get_space_id?(space_name)
128
+ return false if @serverSupportsSpaces.nil?
129
+ url = "#{@serverUrl}/api/Spaces/all?api-key=#{@apiKey}"
130
+ resp = Net::HTTP.get_response(URI.parse(url))
131
+ spaces = JSON.parse(resp.body)
132
+ space_id = spaces.select {|e| e["Name"] == space_name}.first["Id"]
133
+ space_id
134
+ end
135
+
136
+ end
137
+
138
+ def octopus_deploy_account(*url_and_api_key, account_name)
139
+ serverUrl, apiKey = get_octopus_creds(url_and_api_key)
140
+
141
+ OctopusDeployAccount.new(serverUrl, apiKey, account_name)
142
+ end
143
+
144
+ def octopus_account(*url_and_api_key, account_name)
145
+ serverUrl, apiKey = get_octopus_creds(url_and_api_key)
146
+
147
+ OctopusDeployAccount.new(serverUrl, apiKey, account_name)
148
+ end
149
+
150
+ private
151
+
152
+ def get_account_via_api(serverUrl, apiKey, account_name)
153
+ account = nil
154
+
155
+ unless @spaceId.nil?
156
+ # set the spaceId correctly
157
+ @spaceFragment = "#{@spaceId}/"
158
+ end
159
+
160
+ url = "#{serverUrl}/api/#{@spaceFragment}accounts/all?api-key=#{apiKey}"
161
+
162
+ begin
163
+ resp = Net::HTTP.get_response(URI.parse(url))
164
+ body = JSON.parse(resp.body)
165
+ account = body.select {|i| i['Name'] == account_name }.first unless body.nil?
166
+ rescue => e
167
+ raise "get_account_via_api: Unable to connect to #{url}: #{e}"
168
+ end
169
+
170
+ account
171
+ end
172
+
173
+
174
+ end
175
+
176
+ include Serverspec::Type