Permalink
Browse files

[#62889914] Add essential gem files

These only have what is required for vcloud-core, so removing unnecessary dependencies. Some of these are also probably unnecessary for vcloud-tools but that's a story for another day.
  • Loading branch information...
annashipman committed Jan 17, 2014
1 parent 8746cda commit 449e8d94a272c9bda73f069713798691c11f84ea
Showing with 52 additions and 171 deletions.
  1. +1 −15 .gitignore
  2. +1 −1 Gemfile
  3. +1 −1 LICENSE.txt
  4. +17 −113 README.md
  5. +3 −41 Rakefile
  6. +29 −0 vcloud-core.gemspec
@@ -1,16 +1,2 @@
*.gem
*.rbc
*.swp
*.un~
vcloud_env.sh
replace_variables.sh
/.bundle/
/.ruby-version
/Gemfile.lock
/bundle/
/pkg/
vendor/
coverage/
results.html
fog_integration_test.config
.idea
/coverage/
@@ -1,4 +1,4 @@
source 'http://rubygems.org'
source 'https://rubygems.org'
gemspec
@@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2013 HM Government (Government Digital Service)
Copyright (c) 2014 HM Government (Government Digital Service)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
130 README.md
@@ -1,125 +1,29 @@
Vcloud-tools guide
============
# VCloud Core
A collection of tools that support automation of VMWare VCloud Director
VCloud Core is a gem that supports automatated provisioning of VMWare vCloud Director. It uses Fog under the hood. Primarily developed to support [VCloud Walker](https://github.com/alphagov/vcloud-walker) and [VCloud Tools](https://github.com/alphagov/vcloud-tools).
## [Vcloud Launch][vcloud-launch]
A tool that takes a YAML configuration file describing a vDC, and provisions
the vApps and VMs contained within.
## Installation
## [Vcloud Walker][vcloudwalker]
A tool that reports on the current state of an environment
Add this line to your application's Gemfile:
## [Vcloud Query][vcloud-query]
A tool to expose the vCloud Query API.
gem 'vcloud-core'
## [Configure edgegateway services][edgegateway]
Examples of fog usage to configure Edge Gateway Services
And then execute:
## [Tag search][tag_search]
A tool that will perform operations on a set of Vapps that match the given tags.
$ bundle
Required set-up
===============
Or install it yourself as:
VCloud-tools is based around [fog].
$ gem install vcloud-core
To use it you need a `.fog` file in your home directory.
## Usage
For example:
TODO
test:
vcloud_director_username: 'username@org_name'
vcloud_director_password: 'password'
vcloud_director_host: 'host.api.example.com'
## Contributing
Unfortunately current usage of fog requires the password in this file. Multiple sets of credentials can be specified in the fog file, using the following format:
test:
vcloud_director_username: 'username@org_name'
vcloud_director_password: 'password'
vcloud_director_host: 'host.api.example.com'
test2:
vcloud_director_username: 'username@org_name'
vcloud_director_password: 'password'
vcloud_director_host: 'host.api.vendor.net'
You can then pass the `FOG_CREDENTIAL` environment variable at the start of your command. The value of the `FOG_CREDENTIAL` environment variable is the name of the credential set in your fog file which you wish to use. For instance:
FOG_CREDENTIAL=test2 bundle exec vcloud-launch node.yaml
## Other settings
Due to parallel development with the Fog gem there is some jiggery-pokery to run
the tool from source. Our Gemfile uses an env var to guide the installation of fog.
If you do nothing, bundler will use the most recent release of fog (pinned by us).
This might work, but if you want to use recent additions, it might be worth using the
latest fog code; we do. Don't worry, we've made this easy.
Setting `VCLOUD_TOOLS_DEV_FOG_MASTER=true` will fetch
Fog's lastest code, to be used with the vcloud-tools. When developing new features
in conjunction with changes in fog, Setting `VCLOUD_TOOLS_DEV_FOG_LOCAL` allows
development against a local version of Fog before changes have reached the fog
master.
## Troubleshooting
To troubleshoot fog related issues, set environment variables DEBUG or EXCON_DEBUG.
For more details see: http://fog.io/about/getting_started.html#debugging.
## Testing
Default target: `bundle exec rake`
Runs the unit and feature tests (pretty quick right now)
Unit tests: `bundle exec rake spec`
Runs the the fastest feedback cycle
Integration tests: `bundle exec rake integration_test`
Not included in the above test runs
You need access to an environment as the integration test actually spins up a
VM. The easiest thing to do is create a local shell script called
`vcloud_env.sh` and set the contents:
export FOG\_CREDENTIAL=test
export VCLOUD\_VDC\_NAME="Name of the VDC"
export VCLOUD\_CATALOG\_NAME="catalog-name"
export VCLOUD\_TEMPLATE\_NAME="name-of-template"
export VCLOUD\_NETWORK1\_NAME="name-of-primary-network"
export VCLOUD\_NETWORK2\_NAME="name-of-secondary-network"
export VCLOUD\_NETWORK1\_IP="ip-on-primary-network"
export VCLOUD\_NETWORK2\_IP="ip-on-secondary-network"
export VCLOUD\_TEST\_STORAGE\_PROFILE="storage-profile-name"
export VCLOUD\_EDGE\_GATEWAY="name-of-edge-gateway-in-vdc"
Then run this before you run the integration tests.
### Specific integration tests
#### Storage profile tests
There is an integration test to check storage profile behaviour, but it requires a lot of set-up so it is not called by the rake task. If you wish to run it you need access to an environment that has two VDCs, each one containing a storage profile with the same name. This named storage profile needs to be different from teh default storage profile.
You will need to set the following environment variables:
export VDC\_NAME\_1="Name of the first vDC"
export VDC\_NAME\_2="Name of the second vDC"
export VCLOUD\_CATALOG\_NAME="Catalog name" # Can be the same as above settings if appropriate
export VCLOUD\_TEMPLATE\_NAME="Template name" # Can be the same as above setting if appropriate
export VCLOUD\_STORAGE\_PROFILE\_NAME="Storage profile name" # This needs to exist in both vDCs
export VDC\_1\_STORAGE\_PROFILE\_HREF="Href of the named storage profile in vDC 1"
export VDC\_2\_STORAGE\_PROFILE\_HREF="Href of the named storage profile in vDC 2"
export DEFAULT\_STORAGE\_PROFILE\_NAME="Default storage profile name"
export DEFAULT\_STORAGE\_PROFILE\_HREF="Href of default storage profile"
To run this test: `rspec spec/integration/launcher/storage_profile_integration_test.rb`
[vcloudwalker]: https://github.com/alphagov/vcloud-walker
[edgegateway]: docs/edgegateway.md
[tag_search]: docs/tag_search.md
[vcloud-launch]: docs/vcloud-launch.md
[vcloud-query]: docs/vcloud-query.md
[fog]: http://fog.io/
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request
@@ -1,50 +1,12 @@
require 'bundler'
require "bundler/gem_tasks"
require 'rake/clean'
require 'rake/testtask'
require 'cucumber'
require 'cucumber/rake/task'
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
require 'jeweler'
require 'vcloud/version'
include Rake::DSL
Bundler::GemHelper.install_tasks
Rake::TestTask.new do |t|
t.pattern = 'test/tc_*.rb'
end
CUKE_RESULTS = 'results.html'
CLEAN << CUKE_RESULTS
Cucumber::Rake::Task.new(:features) do |t|
t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format pretty --no-source -x"
t.fork = false
end
RSpec::Core::RakeTask.new(:spec) do |task|
# Set a bogus Fog credential, otherwise it's possible for the unit
# tests to accidentially run (and succeed against!) an actual
# tests to accidentially run (and succeed against!) an actual
# environment, if Fog connection is not stubbed correctly.
ENV['FOG_CREDENTIAL'] = 'random_nonsense_owiejfoweijf'
task.pattern = FileList['spec/vcloud/**/*_spec.rb']
end
RSpec::Core::RakeTask.new('integration:quick') do |t|
t.rspec_opts = %w(--tag ~take_too_long)
t.pattern = FileList['spec/integration/**/*_spec.rb']
end
RSpec::Core::RakeTask.new('integration:all') do |t|
t.pattern = FileList['spec/integration/**/*_spec.rb']
end
task :default => [:spec,:features]
Jeweler::Tasks.new do |gem|
gem.name = 'vcloud-tools'
gem.version = Vcloud::VERSION
end
Jeweler::RubygemsDotOrgTasks.new
task :default => [:spec]
@@ -0,0 +1,29 @@
# -*- encoding: utf-8 -*-
lib = File.expand_path('../lib/', __FILE__)
$LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib)
require 'vcloud/core/version'
Gem::Specification.new do |s|
s.name = 'vcloud-core'
s.version = Vcloud::Core::VERSION
s.authors = ['Government Digital Service']
s.summary = 'Core tools for interacting with VMware vCloud Director'
s.description = 'Core tools for interacting with VMware vCloud Director'
s.homepage = 'http://github.com/alphagov/vcloud-core'
s.license = 'MIT'
s.files = `git ls-files`.split($/)
s.executables = s.files.grep(%r{^bin/}) {|f| File.basename(f)}
s.test_files = s.files.grep(%r{^(test|spec|features)/})
s.require_paths = ['lib']
s.required_ruby_version = '>= 1.9.2'
s.add_runtime_dependency 'fog', '>= 1.19.0'
s.add_runtime_dependency 'methadone'
s.add_development_dependency 'rake'
s.add_development_dependency 'rspec', '~> 2.14.1'
s.add_development_dependency 'simplecov', '~> 0.8.2'
end

0 comments on commit 449e8d9

Please sign in to comment.