Sha256: eeb1f4ffdbc254fede2c6278d336419e20bd12b319c589f01b2887db4d88677c
Contents?: true
Size: 1.55 KB
Versions: 1
Compression:
Stored size: 1.55 KB
Contents
# # Author:: Cary Penniman (<cary@rightscale.com>) # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. provides "rightscale" require_plugin "ec2" def on_rightscale_platform? return false if (ec2 == nil || ec2[:userdata].match(/RS_/) == nil) # only ec2 supported true end # this is a hack to convert the RS_<server> tokens into something more # intuative. Hopefully this will be removed when we stop using EC2 # userdata. def add_server(key, data) server_names = { "RS_sketchy" => "sketchy", "RS_syslog" => "syslog", "RS_lumberjack" => "lumberjack", "RS_server" => "core" } rightscale[:server][server_names[key]] = data unless (server_names[key] == nil) end # add all 'RS_' tokens in userdata, but perform translation for server names def get_data rightscale[:server] = Mash.new data_array = ec2[:userdata].split('&') data_array.each do |d| key, data = d.split('=') rightscale[key.sub(/RS_/,'')] = data unless add_server(key,data) end end if on_rightscale_platform? rightscale Mash.new get_data end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rightscale-ohai-0.3.3.1 | lib/ohai/plugins/rightscale.rb |