octopus-serverspec-extensions 0.8.1 → 0.9.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: e775a7410ae69eb5662d6f544f8f75daafec8e97
4
- data.tar.gz: 858cb7be0c693633ae197af6188394b1dc506485
3
+ metadata.gz: 6606486e21632caede12b36c01113384b6b337d5
4
+ data.tar.gz: ad52a7b87498e0bc497227847deb042c1c01a138
5
5
  SHA512:
6
- metadata.gz: 8fbe7ce171b077fb75f260f7cf850bc8e067dbb36810e86e83f82be92b795425bd7754d3519b0347b4644743e70ab953eaf300e10fa633caaea3abaafdca47d8
7
- data.tar.gz: a11bb6aeb6c25541369130896c707df9efb7ab820f7b9af46e6246bcffc86668e7276dae527a5e0683f5c142d1496e8eee79e3220dcdb112d698c35c4efc029a
6
+ metadata.gz: 4309ebf10e4c18c46cfdccb0d68701af725ccfe75cc27e2218556e35fcff1e6e464e287a8202f1ffdd50826f0e6f12d42a781cf450b986f02f86d3f8e0530eb2
7
+ data.tar.gz: 65dd6f12c9fc58b04880afd1ce25f4588a6dc026d945a98c439127893a13c555eda6bd7b1c7b6557b62da7e733d85afd9071ae3af62d002c5b83258499a149c9
@@ -3,6 +3,7 @@ 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
5
  require 'octopus_serverspec_extensions/type/windows_firewall.rb'
6
+ require 'octopus_serverspec_extensions/type/windows_scheduled_task.rb'
6
7
  require 'octopus_serverspec_extensions/matcher/have_version.rb'
7
8
  require 'octopus_serverspec_extensions/matcher/run_under_account.rb'
8
9
  require 'octopus_serverspec_extensions/matcher/have_windows_line_endings.rb'
@@ -0,0 +1,33 @@
1
+ require 'serverspec'
2
+ require 'serverspec/type/base'
3
+ require 'csv'
4
+
5
+ module Serverspec::Type
6
+ class WindowsScheduledTask < Base
7
+ attr_reader :state, :user_id, :run_level, :schedule_type, :repeat_every
8
+ @exists = false
9
+
10
+ def initialize(name)
11
+ @name = name
12
+ @runner = Specinfra::Runner
13
+
14
+ stdout = `schtasks /query /tn \"#{name}\" /fo csv /v`
15
+ return unless $?.success?
16
+ csv = CSV.parse(stdout)
17
+ @exists = true
18
+ headers = csv[0]
19
+ data = csv[1]
20
+ @state = data[headers.index{|x|x=="Status"}]
21
+ @user_id = data[headers.index{|x|x=="Run As User"}]
22
+ @run_level = data[headers.index{|x|x=="Logon Mode"}]
23
+ @schedule_type = data[headers.index{|x|x=="Schedule Type"}]
24
+ @repeat_every = data[headers.index{|x|x=="Repeat: Every"}]
25
+ end
26
+ end
27
+
28
+ def windows_scheduled_task(name)
29
+ WindowsScheduledTask.new(name)
30
+ end
31
+ end
32
+
33
+ include Serverspec::Type
@@ -1,3 +1,3 @@
1
1
  module OctopusServerSpecExtensions
2
- VERSION = "0.8.1"
2
+ VERSION = "0.9.0"
3
3
  end
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.8.1
4
+ version: 0.9.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-16 00:00:00.000000000 Z
11
+ date: 2017-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: serverspec
@@ -162,6 +162,7 @@ files:
162
162
  - lib/octopus_serverspec_extensions/type/npm_package.rb
163
163
  - lib/octopus_serverspec_extensions/type/octopus_deploy_tentacle.rb
164
164
  - lib/octopus_serverspec_extensions/type/windows_firewall.rb
165
+ - lib/octopus_serverspec_extensions/type/windows_scheduled_task.rb
165
166
  - lib/octopus_serverspec_extensions/version.rb
166
167
  - octopus-serverspec-extensions.gemspec
167
168
  homepage: https://github.com/octopus-deploy/octopus-serverspec-extensions