Skip to content

Commit

Permalink
add a version command to supermarket-ctl
Browse files Browse the repository at this point in the history
Matches the one in Chef Server[1]

[1] chef/chef-server#1485

Signed-off-by: Robb Kidd <rkidd@chef.io>
  • Loading branch information
robbkidd committed May 16, 2019
1 parent 27a9ae1 commit 83fac17
Showing 1 changed file with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#
# Copyright:: Copyright (c) 2019 Chef Software, Inc.
#
# 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.
require 'json'

add_command_under_category "version", "general", "Display current version of Supermarket", 2 do
begin
version = JSON.parse(File.read('/opt/supermarket/version-manifest.json'))['build_version']
puts version
rescue Errno::ENOENT => e
puts "Error determining version!"
puts "#{e.message}"
exit(1)
end
end

0 comments on commit 83fac17

Please sign in to comment.