Skip to content

Commit

Permalink
Merge pull request #17 from chef-partners/cli-recipe
Browse files Browse the repository at this point in the history
Recipe for DC/OS CLI
  • Loading branch information
wolf31o2 authored May 18, 2018
2 parents 67655fe + 4c2b4e6 commit 1405bb3
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
26 changes: 26 additions & 0 deletions recipes/cli.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#
# Cookbook Name:: dcos
# Recipe:: cli
#
# Copyright 2018 Chris Gianelloni
#
# 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.
#

cli_base_url = "https://downloads.dcos.io/binaries/cli/#{node['os']}/#{node['kernel']['machine'].tr('_', '-')}"

# Fetch the `dcos` CLI tool
remote_file '/usr/local/bin/dcos' do
source "#{cli_base_url}/dcos-#{node['dcos']['dcos_version'].to_f}/dcos"
mode '0755'
end
22 changes: 22 additions & 0 deletions spec/unit/recipes/cli_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#
# Cookbook Name:: dcos
# Spec:: cli
#

require 'spec_helper'

describe 'dcos::cli' do
context 'Default behavior' do
let(:chef_run) do
ChefSpec::SoloRunner.new(platform: 'centos', version: '7.3.1611').converge(described_recipe)
end

it 'creates remote_file[/usr/local/bin/dcos]' do
expect(chef_run).to create_remote_file('/usr/local/bin/dcos').with(mode: '0755')
end

it 'converges successfully' do
expect { chef_run }.to_not raise_error
end
end
end

0 comments on commit 1405bb3

Please # to comment.