3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/puppet/provider/asadmin.rb', line 3
def asadmin_exec(passed_args)
if @resource.parameters.include?(:dashost)
host = @resource[:dashost]
end
if @resource.parameters.include?(:dasport)
port = @resource[:dasport]
else
port = @resource[:portbase].to_i + 48
end
args = Array.new
args << '--host' << host if host && !host.nil?
args << '--port' << port.to_s
args << '--user' << @resource[:asadminuser]
args << '--passwordfile' << @resource[:passwordfile] if @resource[:passwordfile] and
not @resource[:passwordfile].empty?
passed_args.each { |arg| args << arg }
exec_args = args.join " "
command = "asadmin #{exec_args}"
Puppet.debug("asadmin command = #{command}")
command = "su - #{@resource[:user]} -c \"#{command}\"" if @resource[:user] and
not command.match(/create-service/)
Puppet.debug("exec command = #{command}")
output = `#{command}`
self.fail output unless $? == 0
result = output.split(/\n/)
Puppet.debug("result = \n#{result.inspect}")
result
end
|