我正在尝试用Chef :: ServerAPI替换不推荐使用的Chef :: REST API调用,但似乎无法正常工作。
我正在像这样初始化它:
def initialize(options={})
@account_name = options[:account_name] or raise 'The chef account name has not been set'
@client_name = options[:client_name] or raise 'The chef client name has not been set'
@client_key = options[:client_key] or raise 'The chef client key has not been set'
@cache = Config[:cache] or raise 'The chef_service client has not been configured'
@cache_expiry = Config[:cache_expiry]
@chef_status = ChefStatus.new(Config[:chef_status_url], Config[:chef_status_url_expiry])
end
并且实际的调用在方法中:
def rest
@rest ||= Chef::REST.new(api_url, client_name, nil, raw_key: client_key)
end
我认为我可以打电话:
def rest
@rest ||= Chef::ServerAPI.new(api_url, client_name, nil, raw_key: client_key)
end
但这根本不起作用。如果有人可以给我指点,我将不胜感激。预先感谢。