chef-zero-scheduled-task 0.0.4 → 0.0.5
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: ba0ff7403a98e72130aab8075f648e671aa0071d
|
4
|
+
data.tar.gz: b1ec792ba273e5f7774bcc0c5932c5c3fae06da4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6ba2c795558b572f51e33b2dcde005894f300c2db4e1d26ace3aadf8615c9d2d5a83201576764423ed18854b9d7d05e3547a88081e52e654b899fe1d7e10232
|
7
|
+
data.tar.gz: 0ee7b9a8500655f381832dfa7ec072eb56d59f13e95aaaf311c83ea0dd35a3a1165c0e466b3553e4e84016e46b4fe11bb7b5e69eedafab0862b8170f7f71001c
|
@@ -69,19 +69,27 @@ module Kitchen
|
|
69
69
|
|
70
70
|
def run_scheduled_task_command
|
71
71
|
<<-EOH
|
72
|
-
|
73
|
-
|
74
|
-
|
72
|
+
try {
|
73
|
+
$npipeServer = new-object System.IO.Pipes.NamedPipeServerStream( 'task', [System.IO.Pipes.PipeDirection]::In)
|
74
|
+
$pipeReader = new-object System.IO.StreamReader($npipeServer)
|
75
75
|
schtasks /run /tn "chef-tk"
|
76
|
-
$
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
$
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
76
|
+
$npipeserver.waitforconnection()
|
77
|
+
$host.ui.writeline('Connected to the scheduled task.')
|
78
|
+
while ($npipeserver.IsConnected) {
|
79
|
+
$output = $pipereader.ReadLine()
|
80
|
+
if ($output -like 'SCHEDULED_TASK_DONE:*') {
|
81
|
+
$exit_code = ($output -replace 'SCHEDULED_TASK_DONE:').trim()
|
82
|
+
}
|
83
|
+
else {
|
84
|
+
$host.ui.WriteLine($output)
|
85
|
+
}
|
86
|
+
}
|
87
|
+
}
|
88
|
+
finally {
|
89
|
+
$pipereader.dispose()
|
90
|
+
$npipeserver.dispose()
|
91
|
+
$host.setshouldexit($exit_code)
|
92
|
+
}
|
85
93
|
EOH
|
86
94
|
end
|
87
95
|
|
@@ -95,19 +103,22 @@ module Kitchen
|
|
95
103
|
|
96
104
|
def scheduled_task_command
|
97
105
|
<<-EOH
|
98
|
-
$pre_cmd = '$env:temp = "' + $env:temp + '"'
|
106
|
+
$pre_cmd = '$env:temp = "' + $env:temp + '"' + ";"
|
107
|
+
$pre_cmd += 'start-sleep -seconds 5;'
|
108
|
+
$pre_cmd += '$npipeClient = new-object System.IO.Pipes.NamedPipeClientStream( $env:ComputerName,'
|
109
|
+
$pre_cmd += '"task", [System.IO.Pipes.PipeDirection]::Out); $npipeclient.connect();'
|
110
|
+
$pre_cmd += '$pipeWriter = new-object System.IO.StreamWriter($npipeClient);'
|
111
|
+
$pre_cmd += '$pipeWriter.AutoFlush = $true'
|
99
112
|
$cmd_path = "#{remote_path_join(config[:root_path], 'chef-client-script.ps1')}"
|
100
|
-
$cmd_to_eval = gc $cmd_path | out-string
|
101
|
-
$cmd = $executioncontext.invokecommand.expandstring($cmd_to_eval)
|
102
|
-
$
|
103
|
-
$
|
104
|
-
if (-not (test-path $cmd_folder)) {$null = mkdir $cmd_folder}
|
105
|
-
$pre_cmd, $cmd, $post_cmd | out-file $cmd_path
|
113
|
+
$cmd_to_eval = gc $cmd_path -readcount 0 | out-string
|
114
|
+
$cmd = $executioncontext.invokecommand.expandstring($cmd_to_eval) -replace '\r\n'
|
115
|
+
$cmd = "$cmd | " + '% {} {$pipewriter.writeline($_)} {$pipewriter.writeline("SCHEDULED_TASK_DONE: $LastExitCode");$pipewriter.dispose();$npipeclient.dispose()}'
|
116
|
+
$pre_cmd, $cmd | out-file $cmd_path
|
106
117
|
EOH
|
107
118
|
end
|
108
119
|
|
109
120
|
def prepare_client_zero_script
|
110
|
-
cmd = [local_mode_command, *chef_client_args
|
121
|
+
cmd = [local_mode_command, *chef_client_args].join(' ')
|
111
122
|
File.open(File.join(sandbox_path, 'chef-client-script.ps1'), 'w') do |file|
|
112
123
|
file.write(cmd)
|
113
124
|
end
|
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.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Murawski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|