/usr/lib/ruby/vendor_ruby/chef_zero/endpoints/license_endpoint.rb is in chef-zero 4.5.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | require 'ffi_yajl'
require 'chef_zero/rest_base'
module ChefZero
module Endpoints
# /license
class LicenseEndpoint < RestBase
MAX_NODE_COUNT = 25
def get(request)
node_count = 0
list_data(request, [ 'organizations' ]).each do |orgname|
node_count += list_data(request, [ 'organizations', orgname, 'nodes' ]).size
end
json_response(200, {
"limit_exceeded" => (node_count > MAX_NODE_COUNT) ? true : false,
"node_license" => MAX_NODE_COUNT,
"node_count" => node_count,
"upgrade_url" => 'http://blah.com'
})
end
end
end
end
|