chef-zero-scheduled-task 0.0.10 → 0.0.11
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: 9856132650063f5768cf8d2ec0784db9e958854a
|
4
|
+
data.tar.gz: 5b8c13e93070018f9730405659f1dd044bcb7f53
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c2c2658b28130e8706a51c0022ccfb832739cf112bc32ca9fa6047146d2fd98c448e0941707dbc0ed6d1ae1d8e2d69207828b60e789ba3f025a17e398d08c90
|
7
|
+
data.tar.gz: 637e521f09f4ebedce7e3d2da615c51f017b0c75342850cee9c152d0220c0bd1b82ead37294db79579f1298d51ed96a28aa557fc20c9f7989eb825d9c0c19903
|
@@ -30,18 +30,6 @@ module Kitchen
|
|
30
30
|
|
31
31
|
default_config :task_password
|
32
32
|
|
33
|
-
def prepare_command
|
34
|
-
if windows_os?
|
35
|
-
debug("Serializing $env:temp")
|
36
|
-
wrap_shell_code(<<-EOH
|
37
|
-
"`$env:temp = '$env:temp'" |
|
38
|
-
out-file $env:temp/kitchen/env.ps1
|
39
|
-
EOH
|
40
|
-
)
|
41
|
-
end
|
42
|
-
super
|
43
|
-
end
|
44
|
-
|
45
33
|
def init_command
|
46
34
|
if windows_os?
|
47
35
|
info("Creating the scheduled task.")
|
@@ -54,7 +42,7 @@ module Kitchen
|
|
54
42
|
def run_command
|
55
43
|
if windows_os?
|
56
44
|
script = "$script = @'\n#{scheduled_task_command_script}\n'@\n" \
|
57
|
-
"\n$Script | out-file \"$env:temp/kitchen/chef-client-script.ps1\"" \
|
45
|
+
"\n$ExecutionContext.InvokeCommand.ExpandString($Script) | out-file \"$env:temp/kitchen/chef-client-script.ps1\"" \
|
58
46
|
"\n#{run_scheduled_task_command}"
|
59
47
|
wrap_shell_code(script)
|
60
48
|
else
|
@@ -92,24 +80,25 @@ module Kitchen
|
|
92
80
|
|
93
81
|
def run_scheduled_task_command
|
94
82
|
<<-EOH
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
83
|
+
try {
|
84
|
+
Add-Type -AssemblyName System.Core
|
85
|
+
$npipeServer = new-object System.IO.Pipes.NamedPipeServerStream('task',
|
86
|
+
[System.IO.Pipes.PipeDirection]::In)
|
87
|
+
$pipeReader = new-object System.IO.StreamReader($npipeServer)
|
88
|
+
schtasks /run /tn "chef-tk"
|
89
|
+
$npipeserver.waitforconnection()
|
90
|
+
$host.ui.writeline('Connected to the scheduled task.')
|
91
|
+
while ($npipeserver.IsConnected) {
|
92
|
+
$output = $pipereader.ReadLine()
|
93
|
+
if ($output -like 'SCHEDULED_TASK_DONE:*') {
|
94
|
+
$exit_code = ($output -replace 'SCHEDULED_TASK_DONE:').trim()
|
95
|
+
}
|
96
|
+
else { $host.ui.WriteLine($output) } } }
|
97
|
+
finally {
|
98
|
+
$pipereader.dispose()
|
99
|
+
$npipeserver.dispose()
|
100
|
+
$host.setshouldexit($exit_code)
|
101
|
+
}
|
113
102
|
EOH
|
114
103
|
end
|
115
104
|
|
@@ -138,20 +127,20 @@ module Kitchen
|
|
138
127
|
|
139
128
|
def scheduled_task_command_script
|
140
129
|
<<-EOH
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
130
|
+
Add-Type -AssemblyName System.Core
|
131
|
+
start-sleep -seconds 5;
|
132
|
+
`$npipeClient = new-object System.IO.Pipes.NamedPipeClientStream(`$env:ComputerName,
|
133
|
+
`'task`', [System.IO.Pipes.PipeDirection]::Out);
|
134
|
+
`$npipeclient.connect();
|
135
|
+
`$pipeWriter = new-object System.IO.StreamWriter(`$npipeClient);
|
136
|
+
`$pipeWriter.AutoFlush = `$true;
|
137
|
+
#{client_zero_command} |
|
138
|
+
foreach-object {} {`$pipewriter.writeline(`$_)} {
|
139
|
+
`$pipewriter.writeline(`"SCHEDULED_TASK_DONE: `$LastExitCode`");
|
140
|
+
`$pipewriter.dispose();
|
141
|
+
`$npipeclient.dispose()
|
142
|
+
}
|
143
|
+
EOH
|
155
144
|
end
|
156
145
|
|
157
146
|
def prepare_client_zero_script
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef-zero-scheduled-task
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Murawski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-kitchen
|