Retire openstack-chef: remove repo content
OpenStack-chef project is retiring - https://review.opendev.org/c/openstack/governance/+/905279 this commit remove the content of this project repo Depends-On: https://review.opendev.org/c/openstack/project-config/+/909134 Change-Id: I92ce7040684b2e2567d6b704789527490499bdb2
This commit is contained in:
parent
d05a3bfc7b
commit
94c1c6b604
|
@ -1,11 +0,0 @@
|
|||
.bundle/
|
||||
berks-cookbooks/
|
||||
.kitchen
|
||||
.vagrant
|
||||
.coverage/
|
||||
*.swp
|
||||
Berksfile.lock
|
||||
Vagrantfile
|
||||
Gemfile.lock
|
||||
local-mode-cache
|
||||
nodes/
|
25
.kitchen.yml
25
.kitchen.yml
|
@ -1,25 +0,0 @@
|
|||
---
|
||||
driver:
|
||||
name: vagrant
|
||||
|
||||
provisioner:
|
||||
name: chef_zero
|
||||
|
||||
platforms:
|
||||
- name: ubuntu-14.04
|
||||
- name: centos-6.6
|
||||
- name: centos-7.1
|
||||
|
||||
suites:
|
||||
- name: default
|
||||
run_list:
|
||||
- recipe[openstack_client::default]
|
||||
attributes:
|
||||
- name: swift
|
||||
run_list:
|
||||
- recipe[openstack_client::_example_swift]
|
||||
attributes:
|
||||
- name: nova
|
||||
run_list:
|
||||
- recipe[openstack_client::_example_nova]
|
||||
attributes:
|
32
.rubocop.yml
32
.rubocop.yml
|
@ -1,32 +0,0 @@
|
|||
inherit_from: .rubocop_todo.yml
|
||||
AllCops:
|
||||
Include:
|
||||
- metadata.rb
|
||||
- Gemfile
|
||||
- attributes/**
|
||||
- libraries/**
|
||||
- providers/**
|
||||
- recipes/**
|
||||
- resources/**
|
||||
- spec/**
|
||||
Exclude:
|
||||
- .cookbooks/**/*
|
||||
- berks-cookbooks/**/*
|
||||
- .bundle/**/*
|
||||
|
||||
Encoding:
|
||||
Exclude:
|
||||
- metadata.rb
|
||||
- Gemfile
|
||||
|
||||
NumericLiterals:
|
||||
Enabled: false
|
||||
|
||||
LineLength:
|
||||
Enabled: false
|
||||
|
||||
WordArray:
|
||||
MinSize: 3
|
||||
|
||||
MethodLength:
|
||||
Max: 15
|
|
@ -1,10 +0,0 @@
|
|||
# This configuration was generated by `rubocop --auto-gen-config`
|
||||
# on 2015-08-31 10:13:18 -0500 using RuboCop version 0.32.1.
|
||||
# The point is for the user to remove these configuration records
|
||||
# one by one as the offenses are removed from the code base.
|
||||
# Note that changes in the inspected code, or installation of new
|
||||
# versions of RuboCop, may require this file to be generated again.
|
||||
|
||||
# Offense count: 1
|
||||
Metrics/AbcSize:
|
||||
Max: 22
|
58
README.md
58
README.md
|
@ -1,58 +0,0 @@
|
|||
Openstack Cookbook
|
||||
==================
|
||||
|
||||
This is a library cookbook to consume openstack cloud resources.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
- TBD
|
||||
|
||||
Attributes
|
||||
----------
|
||||
|
||||
Attributes are self documented in `attributes/*.rb`
|
||||
|
||||
Usage
|
||||
-----
|
||||
#### openstack::default
|
||||
|
||||
Installs [fog](http://fog.io) gem and enabled LWRPs
|
||||
|
||||
```json
|
||||
{
|
||||
"name":"my_node",
|
||||
"run_list": [
|
||||
"recipe[openstack]"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
#### openstack::_example_swift
|
||||
|
||||
Example usage of swift LWRPs
|
||||
|
||||
```json
|
||||
{
|
||||
"name":"my_node",
|
||||
"run_list": [
|
||||
"recipe[openstack]",
|
||||
"recipe[openstack::_example_swift]",
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
If you need a simple swift endpoint to test against, the following blog post will help you set up a [single node swift on rackspace cloud](http://blog.phymata.com/2013/02/18/swift-only-with-openstack-devstack-on-the-rackspace-cloud/).
|
||||
|
||||
Contributing
|
||||
------------
|
||||
|
||||
Please use the typical Contrubution rules we have set up [here](https://wiki.openstack.org/wiki/Chef/GettingStarted#Contributing_to_the_OpenStack_Chef_Cookbooks),
|
||||
if you have any questions about this book please go to `irc.oftc.net:#openstack-chef` or contact the [mailing-list](http://groups.google.com/group/opscode-chef-openstack).
|
||||
|
||||
License and Authors
|
||||
-------------------
|
||||
|
||||
Apache 2
|
||||
|
||||
Paul Czarkowski, username.taken@gmail.com
|
|
@ -0,0 +1,10 @@
|
|||
This project is no longer maintained.
|
||||
|
||||
The contents of this repository are still available in the Git
|
||||
source code management system. To see the contents of this
|
||||
repository before it reached its end of life, please check out the
|
||||
previous commit with "git checkout HEAD^1".
|
||||
|
||||
For any further questions, please email
|
||||
openstack-discuss@lists.openstack.org or join #openstack-dev on
|
||||
OFTC.
|
41
Rakefile
41
Rakefile
|
@ -1,41 +0,0 @@
|
|||
task default: ["test"]
|
||||
|
||||
task :test => [:lint, :style, :unit]
|
||||
|
||||
desc "Vendor the cookbooks in the Berksfile"
|
||||
task :berks_prep do
|
||||
sh %{chef exec berks vendor}
|
||||
end
|
||||
|
||||
desc "Get the gems installed"
|
||||
task :bundle do
|
||||
sh %(chef exec gem install -g)
|
||||
end
|
||||
|
||||
desc "Run FoodCritic (lint) tests"
|
||||
task :lint do
|
||||
sh %{chef exec foodcritic --epic-fail any --tags ~FC003 --tags ~FC023 .}
|
||||
end
|
||||
|
||||
desc "Run RuboCop (style) tests"
|
||||
task :style do
|
||||
sh %{chef exec rubocop}
|
||||
end
|
||||
|
||||
desc "Run RSpec (unit) tests"
|
||||
task :unit => [:berks_prep, :bundle] do
|
||||
sh %{chef exec rspec --format documentation}
|
||||
end
|
||||
|
||||
desc "Remove the berks-cookbooks directory and the Berksfile.lock"
|
||||
task :clean do
|
||||
rm_rf [
|
||||
'berks-cookbooks',
|
||||
'Berksfile.lock'
|
||||
]
|
||||
end
|
||||
|
||||
desc "Integration test"
|
||||
task :integration => [:berks_prep, :bundle] do
|
||||
sh %(chef exec kitchen test)
|
||||
end
|
12
Thorfile
12
Thorfile
|
@ -1,12 +0,0 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require 'bundler'
|
||||
require 'bundler/setup'
|
||||
require 'berkshelf/thor'
|
||||
|
||||
begin
|
||||
require 'kitchen/thor_tasks'
|
||||
Kitchen::ThorTasks.new
|
||||
rescue LoadError
|
||||
puts '>>>>> Kitchen gem not loaded, omitting tasks' unless ENV['CI']
|
||||
end
|
|
@ -1,19 +0,0 @@
|
|||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
Vagrant.configure('2') do |config|
|
||||
config.vm.hostname = 'openstack_client'
|
||||
config.vm.box = 'ubuntu-12.04'
|
||||
config.vm.box_url = "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_#{config.vm.box}_chef-provisionerless.box"
|
||||
config.omnibus.chef_version = 'latest'
|
||||
config.berkshelf.enabled = true
|
||||
|
||||
config.vm.provision :chef_solo do |chef|
|
||||
chef.json = {
|
||||
}
|
||||
|
||||
chef.run_list = [
|
||||
'recipe[openstack_client::default]'
|
||||
]
|
||||
end
|
||||
end
|
|
@ -1,12 +0,0 @@
|
|||
# Encoding: utf-8
|
||||
#
|
||||
# Cookbook Name:: openstack_client
|
||||
# Attributes:: default
|
||||
#
|
||||
# Copyright 2014, Paul Czarkowski
|
||||
#
|
||||
|
||||
# Dependencies and versions
|
||||
|
||||
default['openstack_client']['fog_version'] = '~> 1.23.0'
|
||||
default['openstack_client']['nokogiri_version'] = '~> 1.6.2.1'
|
|
@ -1,9 +0,0 @@
|
|||
#!/bin/bash -x
|
||||
## This script is for installing all the needed packages on trusty to run the chef tests with 'chef exec rake'.
|
||||
## It relies on the common bootstrap.sh from openstack/cookbook-openstack-common for installing common dependencies.
|
||||
|
||||
curl https://raw.githubusercontent.com/openstack/cookbook-openstack-common/master/bootstrap.sh \
|
||||
--retry 3 \
|
||||
--silent \
|
||||
--show-error \
|
||||
| /bin/bash -x
|
94
chefignore
94
chefignore
|
@ -1,94 +0,0 @@
|
|||
# Put files/directories that should be ignored in this file when uploading
|
||||
# or sharing to the community site.
|
||||
# Lines that start with '# ' are comments.
|
||||
|
||||
# OS generated files #
|
||||
######################
|
||||
.DS_Store
|
||||
Icon?
|
||||
nohup.out
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
|
||||
# SASS #
|
||||
########
|
||||
.sass-cache
|
||||
|
||||
# EDITORS #
|
||||
###########
|
||||
\#*
|
||||
.#*
|
||||
*~
|
||||
*.sw[a-z]
|
||||
*.bak
|
||||
REVISION
|
||||
TAGS*
|
||||
tmtags
|
||||
*_flymake.*
|
||||
*_flymake
|
||||
*.tmproj
|
||||
.project
|
||||
.settings
|
||||
mkmf.log
|
||||
|
||||
## COMPILED ##
|
||||
##############
|
||||
a.out
|
||||
*.o
|
||||
*.pyc
|
||||
*.so
|
||||
*.com
|
||||
*.class
|
||||
*.dll
|
||||
*.exe
|
||||
*/rdoc/
|
||||
|
||||
# Testing #
|
||||
###########
|
||||
.watchr
|
||||
.rspec
|
||||
spec/*
|
||||
spec/fixtures/*
|
||||
test/*
|
||||
features/*
|
||||
Guardfile
|
||||
Procfile
|
||||
|
||||
# SCM #
|
||||
#######
|
||||
.git
|
||||
*/.git
|
||||
.gitignore
|
||||
.gitmodules
|
||||
.gitconfig
|
||||
.gitattributes
|
||||
.svn
|
||||
*/.bzr/*
|
||||
*/.hg/*
|
||||
*/.svn/*
|
||||
|
||||
# Berkshelf #
|
||||
#############
|
||||
cookbooks/*
|
||||
tmp
|
||||
|
||||
# Cookbooks #
|
||||
#############
|
||||
CONTRIBUTING
|
||||
CHANGELOG*
|
||||
|
||||
# Strainer #
|
||||
############
|
||||
Colanderfile
|
||||
Strainerfile
|
||||
.colander
|
||||
.strainer
|
||||
|
||||
# Vagrant #
|
||||
###########
|
||||
.vagrant
|
||||
Vagrantfile
|
||||
|
||||
# Travis #
|
||||
##########
|
||||
.travis.yml
|
|
@ -1,31 +0,0 @@
|
|||
#
|
||||
# Cookbook Name:: openstack_client
|
||||
# Library:: openstack
|
||||
# Author:: Paul Czarkowski
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
module Openstack
|
||||
# The client module starts here
|
||||
module Client
|
||||
def initialize(name, run_context = nil)
|
||||
super
|
||||
begin
|
||||
require 'fog'
|
||||
rescue LoadError
|
||||
Chef::Log.error("Missing gem 'fog'. Use the default openstack_client recipe to install it first.")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,16 +0,0 @@
|
|||
# encoding: UTF-8
|
||||
if defined?(ChefSpec)
|
||||
def create_openstack_client_nova_server(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(
|
||||
:openstack_client_nova_server,
|
||||
:create,
|
||||
resource_name)
|
||||
end
|
||||
|
||||
def delete_openstack_client_nova_server(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(
|
||||
:openstack_client_nova_server,
|
||||
:delete,
|
||||
resource_name)
|
||||
end
|
||||
end
|
|
@ -1,36 +0,0 @@
|
|||
#
|
||||
# Cookbook Name:: openstack_client
|
||||
# Library:: nova
|
||||
# Author:: JJ Asghar
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
module Openstack
|
||||
module Client
|
||||
# this is required to shut up rubocop
|
||||
module Nova
|
||||
include Openstack::Client
|
||||
|
||||
def nova
|
||||
@nova ||= Fog::Compute.new(provider: 'openstack',
|
||||
openstack_username: new_resource.openstack_username,
|
||||
openstack_api_key: new_resource.openstack_password,
|
||||
openstack_auth_url: new_resource.openstack_auth_url,
|
||||
openstack_tenant: new_resource.openstack_tenant,
|
||||
openstack_region: new_resource.openstack_region
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,41 +0,0 @@
|
|||
#
|
||||
# Cookbook Name:: openstack_client
|
||||
# Library:: storage
|
||||
# Author:: Paul Czarkowski
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
module Openstack
|
||||
module Client
|
||||
# this is required to shut up rubocop
|
||||
module Swift
|
||||
include Openstack::Client
|
||||
|
||||
def swift
|
||||
@swift ||= Fog::Storage.new(provider: 'openstack',
|
||||
openstack_username: new_resource.openstack_username,
|
||||
openstack_api_key: new_resource.openstack_password,
|
||||
openstack_auth_url: new_resource.openstack_auth_url,
|
||||
openstack_tenant: new_resource.openstack_tenant,
|
||||
openstack_region: new_resource.openstack_region,
|
||||
openstack_temp_url_key: new_resource.openstack_temp_url_key,
|
||||
openstack_persistent: new_resource.openstack_persistent,
|
||||
openstack_service_name: new_resource.openstack_service_name,
|
||||
openstack_service_type: new_resource.openstack_service_type,
|
||||
openstack_endpoint_type: new_resource.openstack_endpoint_type
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
16
metadata.rb
16
metadata.rb
|
@ -1,16 +0,0 @@
|
|||
# Encoding: utf-8
|
||||
name 'openstack_client'
|
||||
maintainer 'openstack-chef'
|
||||
maintainer_email 'openstack-discuss@lists.openstack.org'
|
||||
license 'Apache2'
|
||||
description 'Library cookbook to interact with OpenStack Clouds'
|
||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||
version '12.0.0'
|
||||
|
||||
supports 'ubuntu', '>= 14.04'
|
||||
supports 'centos', '>= 6.5'
|
||||
|
||||
depends 'apt', '~> 2.8'
|
||||
depends 'build-essential', '~> 2.1.3'
|
||||
depends 'xml', '~> 1.2.13'
|
||||
depends 'yum', '~> 3.5.4'
|
|
@ -1,49 +0,0 @@
|
|||
#
|
||||
# Cookbook Name:: openstack_client
|
||||
# Provider:: nova_server
|
||||
# Author:: JJ Asghar
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
include Openstack::Client::Nova
|
||||
|
||||
def whyrun_supported?
|
||||
true
|
||||
end
|
||||
|
||||
action :create do
|
||||
require 'fog'
|
||||
name = new_resource.name
|
||||
image = new_resource.image
|
||||
flavor = new_resource.flavor
|
||||
|
||||
ruby_block 'create a server' do
|
||||
block do
|
||||
nova.create_server(name, image, flavor)
|
||||
end
|
||||
end
|
||||
new_resource.updated_by_last_action(true)
|
||||
end
|
||||
|
||||
action :delete do
|
||||
require 'fog'
|
||||
id = new_resource.id
|
||||
|
||||
ruby_block 'delete a server' do
|
||||
block do
|
||||
nova.delete_server(id)
|
||||
end
|
||||
end
|
||||
new_resource.updated_by_last_action(true)
|
||||
end
|
|
@ -1,125 +0,0 @@
|
|||
#
|
||||
# Cookbook Name:: openstack_client
|
||||
# Provider:: swift
|
||||
# Author:: Paul Czarkowski
|
||||
#
|
||||
# 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 'tempfile'
|
||||
require 'chef/digester'
|
||||
|
||||
include Openstack::Client::Swift
|
||||
|
||||
def whyrun_supported?
|
||||
true
|
||||
end
|
||||
|
||||
def load_current_resource
|
||||
@current_resource = Chef::Resource::OpenstackSwiftObject.new(@new_resource.name)
|
||||
@current_resource.file(@new_resource.file)
|
||||
|
||||
if ::File.exist?(@current_resource.file)
|
||||
@current_resource.exists = true
|
||||
@current_resource.checksum = Chef::Digester.checksum_for_file(@current_resource.file)
|
||||
else
|
||||
@current_resource.exists = false
|
||||
new_resource.updated_by_last_action(true)
|
||||
end
|
||||
@current_resource
|
||||
end
|
||||
|
||||
action :create do
|
||||
f = Tempfile.new('download')
|
||||
|
||||
f.binmode if new_resource.binmode
|
||||
|
||||
directory = get_directory(new_resource.container)
|
||||
directory.files.get(object(new_resource)) do |data, _remaining, _content_length|
|
||||
f.syswrite data
|
||||
end
|
||||
|
||||
new_resource.checksum = Chef::Digester.checksum_for_file(f.path)
|
||||
if !current_resource.exists || (current_resource.checksum != new_resource.checksum)
|
||||
converge_by("Moving new file with checksum to #{new_resource.file}") do
|
||||
move_file(f.path, new_resource.file)
|
||||
end
|
||||
new_resource.updated_by_last_action(true)
|
||||
else
|
||||
f.unlink
|
||||
end
|
||||
end
|
||||
|
||||
action :create_if_missing do
|
||||
unless current_resource.exists
|
||||
action_create
|
||||
new_resource.updated_by_last_action(true)
|
||||
end
|
||||
end
|
||||
|
||||
action :delete do
|
||||
if current_resource.exists
|
||||
# Use md5 checksums because CloudFiles etag is md5
|
||||
new_resource.checksum = Chef::Digester.generate_md5_checksum_for_file(new_resource.file)
|
||||
directory = get_directory(new_resource.container)
|
||||
remote_file = directory.files.get(object(new_resource))
|
||||
unless remote_file.nil?
|
||||
converge_by("Destroying object #{object(new_resource)}") do
|
||||
remote_file.destroy
|
||||
end
|
||||
new_resource.updated_by_last_action(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
action :upload do
|
||||
if current_resource.exists
|
||||
# Use md5 checksums because CloudFiles etag is md5
|
||||
new_resource.checksum = Chef::Digester.generate_md5_checksum_for_file(new_resource.file)
|
||||
directory = get_directory(new_resource.container)
|
||||
remote_file = directory.files.get(object(new_resource))
|
||||
if remote_file.nil? || remote_file.etag != new_resource.checksum
|
||||
converge_by("Uploading new file #{object(new_resource)} with
|
||||
checksum #{new_resource.checksum} to #{new_resource.container} container") do
|
||||
directory.files.create key: object(new_resource),
|
||||
body: ::File.open(new_resource.file)
|
||||
end
|
||||
new_resource.updated_by_last_action(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def get_directory(n)
|
||||
directory = swift.directories.get(n)
|
||||
swift.directories.create key: n unless directory
|
||||
directory
|
||||
end
|
||||
|
||||
def object(resource)
|
||||
if resource.object
|
||||
resource.object
|
||||
else
|
||||
::File.basename(resource.file)
|
||||
end
|
||||
end
|
||||
|
||||
# Defining custom method to work around EACCESS errors on Windows when attempting to move across devices.
|
||||
# Attrib to tknerr for workaround found in Berkshelf issue #140
|
||||
def move_file(src, dest)
|
||||
FileUtils.mv(src, dest, force: false)
|
||||
rescue Errno::EACCES
|
||||
FileUtils.cp_r(src, dest)
|
||||
FileUtils.rm_rf(src)
|
||||
end
|
|
@ -1,40 +0,0 @@
|
|||
#
|
||||
# Cookbook Name:: openstack_client
|
||||
# Provider:: _example_nova
|
||||
# Author:: JJ Asghar
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
include_recipe 'openstack_client::default'
|
||||
|
||||
openstack_client_nova_server 'test1' do
|
||||
openstack_username 'USERNAME'
|
||||
openstack_password 'PASSWORD'
|
||||
openstack_auth_url 'https://mybackendopenstack:35357/v2.0/tokens'
|
||||
openstack_tenant 'Project'
|
||||
openstack_region 'region-a'
|
||||
image 'bec3cab5-4722-40b9-a78a-3489218e22fe'
|
||||
flavor '101'
|
||||
action :create
|
||||
end
|
||||
|
||||
openstack_client_nova_server 'test' do
|
||||
openstack_username 'USERNAME'
|
||||
openstack_password 'PASSWORD'
|
||||
openstack_auth_url 'https://mybackendopenstack:35357/v2.0/tokens'
|
||||
openstack_tenant 'Project'
|
||||
openstack_region 'region-a'
|
||||
id 'c6ab5354-baa4-4ea3-af27-ef3eb874472e'
|
||||
action :delete
|
||||
end
|
|
@ -1,62 +0,0 @@
|
|||
#
|
||||
# Cookbook Name:: openstack_client
|
||||
# Provider:: _example_swift
|
||||
# Author:: Paul Czarkowski
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
file '/tmp/bacon' do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode '0755'
|
||||
content 'bacon bacon bacon bacon'
|
||||
action :create
|
||||
end
|
||||
|
||||
openstack_swift_object 'upload_file' do
|
||||
openstack_username 'admin'
|
||||
openstack_password 'devstack'
|
||||
openstack_tenant 'admin'
|
||||
openstack_auth_url 'http://104.130.171.127:5000/v2.0/tokens'
|
||||
container 'potato'
|
||||
file '/tmp/bacon'
|
||||
action :upload
|
||||
end
|
||||
|
||||
file '/tmp/bacon' do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode '0755'
|
||||
action :delete
|
||||
end
|
||||
|
||||
openstack_swift_object 'download_file' do
|
||||
openstack_username 'admin'
|
||||
openstack_password 'devstack'
|
||||
openstack_tenant 'admin'
|
||||
openstack_auth_url 'http://104.130.171.127:5000/v2.0/tokens'
|
||||
container 'potato'
|
||||
file '/tmp/bacon'
|
||||
action :create
|
||||
end
|
||||
|
||||
openstack_swift_object 'delete_file' do
|
||||
openstack_username 'admin'
|
||||
openstack_password 'devstack'
|
||||
openstack_tenant 'admin'
|
||||
openstack_auth_url 'http://104.130.171.127:5000/v2.0/tokens'
|
||||
container 'potato'
|
||||
file '/tmp/bacon'
|
||||
action :delete
|
||||
end
|
|
@ -1,32 +0,0 @@
|
|||
# Encoding: utf-8
|
||||
#
|
||||
# Cookbook Name:: openstack_client
|
||||
# Recipe:: default
|
||||
#
|
||||
# Copyright 2014, Paul Czarkowski
|
||||
#
|
||||
|
||||
# Required to install fog
|
||||
|
||||
case node['platform_family']
|
||||
when 'debian'
|
||||
node.override['apt']['compile_time_update'] = true
|
||||
include_recipe 'apt'
|
||||
|
||||
node.set['build-essential']['compile_time'] = true
|
||||
include_recipe 'build-essential'
|
||||
when 'redhat'
|
||||
include_recipe 'yum'
|
||||
end
|
||||
|
||||
include_recipe 'xml::ruby'
|
||||
|
||||
chef_gem 'nokogiri' do
|
||||
version node['openstack_client']['nokogiri_version']
|
||||
action :upgrade
|
||||
end
|
||||
|
||||
chef_gem 'fog' do
|
||||
version node['openstack_client']['fog_version']
|
||||
action :upgrade
|
||||
end
|
|
@ -1,38 +0,0 @@
|
|||
#
|
||||
# Cookbook Name:: openstack_client
|
||||
# Resource:: nova_server
|
||||
# Author:: JJ Asghar
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
actions :create, :delete
|
||||
|
||||
default_action :create
|
||||
|
||||
BOOLEAN = [TrueClass, FalseClass]
|
||||
|
||||
attribute :openstack_username, kind_of: String, required: true
|
||||
attribute :openstack_password, kind_of: String, required: true
|
||||
attribute :openstack_tenant, kind_of: String, required: true
|
||||
attribute :openstack_region, kind_of: String, default: 'RegionOne'
|
||||
attribute :openstack_auth_url, kind_of: String, required: true
|
||||
attribute :name, kind_of: String, name_attribute: true
|
||||
attribute :id, kind_of: String, name_attribute: true
|
||||
attribute :image, kind_of: String, required: true
|
||||
attribute :flavor, kind_of: String
|
||||
|
||||
def initialize(*args)
|
||||
super
|
||||
@action = :create
|
||||
end
|
|
@ -1,41 +0,0 @@
|
|||
#
|
||||
# Cookbook Name:: openstack_client
|
||||
# Resource:: swift
|
||||
# Author:: Paul Czarkowski
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
actions :create, :create_if_missing, :upload, :delete
|
||||
|
||||
default_action :create
|
||||
|
||||
BOOLEAN = [TrueClass, FalseClass]
|
||||
|
||||
attribute :openstack_username, kind_of: String, required: true
|
||||
attribute :openstack_password, kind_of: String, required: true
|
||||
attribute :openstack_tenant, kind_of: String, required: true
|
||||
attribute :openstack_region, kind_of: String, default: 'RegionOne'
|
||||
attribute :openstack_auth_url, kind_of: String, required: true
|
||||
attribute :openstack_temp_url_key, kind_of: String
|
||||
attribute :openstack_persistent, kind_of: BOOLEAN, default: false
|
||||
attribute :openstack_service_name, kind_of: String
|
||||
attribute :openstack_service_type, kind_of: String
|
||||
attribute :openstack_endpoint_type, kind_of: String
|
||||
attribute :file, kind_of: String, name_attribute: true
|
||||
attribute :container, kind_of: String, required: true
|
||||
attribute :object, kind_of: String
|
||||
attribute :binmode, kind_of: BOOLEAN, default: false
|
||||
|
||||
attr_accessor :exists
|
||||
attr_accessor :checksum
|
|
@ -1,39 +0,0 @@
|
|||
# Encoding: utf-8
|
||||
|
||||
require_relative 'spec_helper'
|
||||
|
||||
describe 'openstack_client::_example_nova' do
|
||||
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
|
||||
let(:node) { runner.node }
|
||||
let(:chef_run) { runner.converge(described_recipe) }
|
||||
|
||||
it 'spins up a test machine' do
|
||||
expect(chef_run).to create_openstack_client_nova_server(
|
||||
'test1').with(action: [:create])
|
||||
end
|
||||
end
|
||||
|
||||
describe 'openstack_client::_example_nova' do
|
||||
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
|
||||
let(:node) { runner.node }
|
||||
let(:chef_run) { runner.converge(described_recipe) }
|
||||
|
||||
it 'deletes a test machine' do
|
||||
expect(chef_run).to delete_openstack_client_nova_server(
|
||||
'test').with(action: [:delete])
|
||||
end
|
||||
end
|
||||
|
||||
describe 'openstack_client::_example_nova' do
|
||||
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
|
||||
let(:node) { runner.node }
|
||||
let(:chef_run) { runner.converge(described_recipe) }
|
||||
|
||||
it 'install the nokogiri gem' do
|
||||
expect(chef_run).to upgrade_chef_gem('nokogiri')
|
||||
end
|
||||
|
||||
it 'install the fog gem' do
|
||||
expect(chef_run).to upgrade_chef_gem('fog')
|
||||
end
|
||||
end
|
|
@ -1,13 +0,0 @@
|
|||
# Encoding: utf-8
|
||||
|
||||
require_relative 'spec_helper'
|
||||
|
||||
describe 'openstack_client::default' do
|
||||
describe 'ubuntu' do
|
||||
let(:chef_run) { ChefSpec::Runner.new.converge(described_recipe) }
|
||||
|
||||
it 'writes some chefspec code' do
|
||||
skip 'todo'
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,22 +0,0 @@
|
|||
# Encoding: utf-8
|
||||
require 'rspec/expectations'
|
||||
require 'chefspec'
|
||||
require 'chefspec/berkshelf'
|
||||
require 'chef/application'
|
||||
|
||||
LOG_LEVEL = :fatal
|
||||
UBUNTU_OPTS = {
|
||||
platform: 'ubuntu',
|
||||
version: '14.04',
|
||||
log_level: ::LOG_LEVEL
|
||||
}
|
||||
REDHAT_OPTS = {
|
||||
platform: 'redhat',
|
||||
version: '7.1',
|
||||
log_level: LOG_LEVEL
|
||||
}
|
||||
::CHEFSPEC_OPTS = {
|
||||
log_level: ::LOG_LEVEL
|
||||
}
|
||||
|
||||
at_exit { ChefSpec::Coverage.report! }
|
|
@ -1,7 +0,0 @@
|
|||
# Encoding: utf-8
|
||||
|
||||
require_relative 'spec_helper'
|
||||
|
||||
describe 'default' do
|
||||
it { skip 'write some tests' }
|
||||
end
|
|
@ -1,11 +0,0 @@
|
|||
# Encoding: utf-8
|
||||
require 'serverspec'
|
||||
|
||||
# Required by serverspec
|
||||
set :backend, :exec
|
||||
|
||||
RSpec.configure do |c|
|
||||
c.before :all do
|
||||
c.path = '/sbin:/usr/bin'
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue