File tree Expand file tree Collapse file tree 1 file changed +17
-15
lines changed
lib/puppet/provider/ibm_impkg Expand file tree Collapse file tree 1 file changed +17
-15
lines changed Original file line number Diff line number Diff line change @@ -100,31 +100,33 @@ def stopprocs
100
100
ps = Facter . value :ps
101
101
regex = Regexp . new ( resource [ :target ] )
102
102
self . debug "Executing '#{ ps } ' to find processes that match #{ resource [ :target ] } "
103
- pid = nil
103
+ pid = [ ]
104
104
IO . popen ( ps ) { |table |
105
105
table . each_line { |line |
106
106
if regex . match ( line )
107
107
self . debug "Process matched: #{ line } "
108
108
ary = line . sub ( /^\s +/ , '' ) . split ( /\s +/ )
109
- pid = ary [ 1 ]
109
+ pid << ary [ 1 ]
110
110
end
111
111
}
112
112
}
113
113
114
114
## If a PID matches, attempt to kill it.
115
- if pid
116
- begin
117
- self . debug "Attempting to kill PID #{ pid } "
118
- output = kill pid
119
- rescue Puppet ::ExecutionFailure
120
- err = <<-EOF
121
- Could not kill #{ self . name } , PID #{ pid } .
122
- In order to install/upgrade to specified target: #{ resource [ :target ] } ,
123
- all related processes need to be stopped.
124
- Output of 'kill #{ pid } ': #{ output }
125
- EOF
126
-
127
- @resource . fail Puppet ::Error , err , $!
115
+ unless pid . empty?
116
+ pid . each do |thepid |
117
+ begin
118
+ self . debug "Attempting to kill PID #{ thepid } "
119
+ output = kill thepid
120
+ rescue Puppet ::ExecutionFailure
121
+ err = <<-EOF
122
+ Could not kill #{ self . name } , PID #{ thepid } .
123
+ In order to install/upgrade to specified target: #{ resource [ :target ] } ,
124
+ all related processes need to be stopped.
125
+ Output of 'kill #{ thepid } ': #{ output }
126
+ EOF
127
+
128
+ @resource . fail Puppet ::Error , err , $!
129
+ end
128
130
end
129
131
end
130
132
You can’t perform that action at this time.
0 commit comments