octopus-serverspec-extensions 0.7.2 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4b7a6531d510a57eb775da9df9d35440b5d3939
|
4
|
+
data.tar.gz: 52132ac836202b8f0b595328d0335b2e58feaa5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f70116f653de98b725067fa4d639784998301b2c6c4ca33ee42fb40f7849fe211ab26a2f78968706a560c907c53e82244dbc605a5bd800c3735ffbddfff87bfc
|
7
|
+
data.tar.gz: a649076b66f42438f313917140d71dcf63f75a50622e587a13c8cf2f6f2dea4c8eb5ab12c806629436781c857e7767fff208d032bd27623500cd1ce25a2de2e4
|
@@ -2,6 +2,7 @@ require 'octopus_serverspec_extensions/type/chocolatey_package.rb'
|
|
2
2
|
require 'octopus_serverspec_extensions/type/npm_package.rb'
|
3
3
|
require 'octopus_serverspec_extensions/type/java_property_file.rb'
|
4
4
|
require 'octopus_serverspec_extensions/type/octopus_deploy_tentacle.rb'
|
5
|
+
require 'octopus_serverspec_extensions/type/windows_firewall.rb'
|
5
6
|
require 'octopus_serverspec_extensions/matcher/have_version.rb'
|
6
7
|
require 'octopus_serverspec_extensions/matcher/run_under_account.rb'
|
7
8
|
require 'octopus_serverspec_extensions/matcher/have_windows_line_endings.rb'
|
@@ -50,6 +50,21 @@ module Serverspec::Type
|
|
50
50
|
!@machine["EnvironmentIds"].select {|e| e == environment_id}.empty?
|
51
51
|
end
|
52
52
|
|
53
|
+
def has_tenant?(tenant_name)
|
54
|
+
return false if @machine.nil?
|
55
|
+
url = "#{@serverUrl}/api/tenants/all?api-key=#{@apiKey}"
|
56
|
+
resp = Net::HTTP.get_response(URI.parse(url))
|
57
|
+
tenants = JSON.parse(resp.body)
|
58
|
+
tenant_id = tenants.select {|e| e["Name"] == tenant_name}.first["Id"]
|
59
|
+
!@machine["TenantIds"].select {|e| e == tenant_id}.empty?
|
60
|
+
end
|
61
|
+
|
62
|
+
def has_tenant_tag?(tag_set, tag)
|
63
|
+
return false if @machine.nil?
|
64
|
+
tenant_tags = @machine["TenantTags"]
|
65
|
+
!tenant_tags.select {|e| e == "#{tag_set}/#{tag}"}.empty?
|
66
|
+
end
|
67
|
+
|
53
68
|
def has_role?(role_name)
|
54
69
|
return false if @machine.nil?
|
55
70
|
roles = @machine["Roles"]
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'serverspec'
|
2
|
+
require 'serverspec/type/base'
|
3
|
+
|
4
|
+
module Serverspec::Type
|
5
|
+
class WindowsFirewall < Base
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
@runner = Specinfra::Runner
|
9
|
+
end
|
10
|
+
|
11
|
+
def has_open_port?(port)
|
12
|
+
command_result = @runner.run_command("$portFilter = (Get-NetFirewallPortFilter | Where-Object { $_.LocalPort -Eq #{port} -and $_.Protocol -eq 'TCP' }); if ($null -eq $portfilter) { return $false } ; $rule = Get-NetFirewallRule -AssociatedNetFirewallPortFilter $portfilter; \"$($rule.Enabled)|$($rule.PrimaryStatus)\"")
|
13
|
+
command_result.stdout.gsub(/\n/, '') == "True|OK"
|
14
|
+
end
|
15
|
+
|
16
|
+
def enabled?
|
17
|
+
command_result = @runner.run_command("(get-service MpsSvc).Status")
|
18
|
+
command_result.stdout.gsub(/\n/, '') == "Running"
|
19
|
+
end
|
20
|
+
|
21
|
+
def to_s
|
22
|
+
"Windows Firewall"
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
def windows_firewall
|
28
|
+
WindowsFirewall.new
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
include Serverspec::Type
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octopus-serverspec-extensions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Richardson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: serverspec
|
@@ -161,6 +161,7 @@ files:
|
|
161
161
|
- lib/octopus_serverspec_extensions/type/java_property_file.rb
|
162
162
|
- lib/octopus_serverspec_extensions/type/npm_package.rb
|
163
163
|
- lib/octopus_serverspec_extensions/type/octopus_deploy_tentacle.rb
|
164
|
+
- lib/octopus_serverspec_extensions/type/windows_firewall.rb
|
164
165
|
- lib/octopus_serverspec_extensions/version.rb
|
165
166
|
- octopus-serverspec-extensions.gemspec
|
166
167
|
homepage: https://github.com/octopus-deploy/octopus-serverspec-extensions
|