69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
# File 'lib/s3_master/cli.rb', line 69
def fetch(buckets=nil, policy_types=S3Master::RemotePolicy::POLICY_TYPES, policy_id=nil)
config = S3Master::Config.new(options[:"config-file"])
buckets ||= config[:buckets].keys
Array(buckets).each do |bucket|
Array(policy_types).each do |policy_type|
next if ! S3Master::RemotePolicy.known_policy_type?(policy_type)
local_policy = S3Master::LocalPolicy.new(config, bucket, policy_type, options.merge(skip_load: true, id: policy_id).symbolize_keys)
remote_policy = S3Master::RemotePolicy.new(bucket, policy_type, {id: policy_id, region: config.region(bucket)})
if !local_policy.basename.nil?
local_policy.write(remote_policy)
else
puts "%s policy:\n%s" % [policy_type, remote_policy.pretty_body]
end
end
end
end
|