53
53
# parameter, so you can specify '--ssldir <directory>' as an argument.
55
55
# See the configuration file documentation at
56
# http://reductivelabs.com/projects/puppet/reference/configref.html for
56
# http://reductivelabs.com/trac/puppet/wiki/ConfigurationReference for
57
57
# the full list of acceptable parameters. A commented list of all
58
58
# configuration options can also be generated by running puppet with
94
94
# Copyright (c) 2005 Reductive Labs, LLC
95
95
# Licensed under the GNU Public License
98
require 'puppet/network/client'
102
[ "--bucket", "-b", GetoptLong::REQUIRED_ARGUMENT ],
103
[ "--debug", "-d", GetoptLong::NO_ARGUMENT ],
104
[ "--help", "-h", GetoptLong::NO_ARGUMENT ],
105
[ "--local", "-l", GetoptLong::NO_ARGUMENT ],
106
[ "--remote", "-r", GetoptLong::NO_ARGUMENT ],
107
[ "--verbose", "-v", GetoptLong::NO_ARGUMENT ],
108
[ "--version", "-V", GetoptLong::NO_ARGUMENT ]
111
# Add all of the config parameters as valid options.
112
Puppet.settings.addargs(options)
114
result = GetoptLong.new(*options)
119
result.each { |opt,arg|
122
puts "%s" % Puppet.version
125
if Puppet.features.usage?
128
puts "No help available unless you have RDoc::usage installed"
132
options[:bucket] = arg
134
options[:verbose] = true
136
options[:debug] = true
138
options[:local] = true
140
options[:remote] = true
142
Puppet.settings.handlearg(opt, arg)
145
rescue GetoptLong::InvalidOption => detail
146
$stderr.puts "Try '#{$0} --help'"
150
Puppet::Log.newdestination(:console)
158
Puppet::Log.level = :debug
159
elsif options[:verbose]
160
Puppet::Log.level = :info
163
# Now parse the config
166
if Puppet.settings.print_configs?
167
exit(Puppet.settings.print_configs ? 0 : 1)
171
if options[:local] or options[:bucket]
172
path = options[:bucket] || Puppet[:bucketdir]
173
client = Puppet::Network::Client.dipper.new(:Path => path)
175
require 'puppet/network/handler'
176
client = Puppet::Network::Client.dipper.new(:Server => Puppet[:server])
181
puts detail.backtrace
190
out = client.getfile(md5)
194
unless FileTest.exists?(file)
195
$stderr.puts "%s: no such file" % file
198
unless FileTest.readable?(file)
199
$stderr.puts "%s: cannot read file" % file
202
md5 = client.backup(file)
203
puts "%s: %s" % [file, md5]
208
client.restore(file, md5)
210
raise "Invalid mode %s" % mode
97
require 'puppet/application'
98
require 'puppet/application/filebucket'
100
# launch the filebucket
101
Puppet::Application[:filebucket].run