├── CHANGELOG ├── .gitignore ├── spec ├── acceptance │ ├── nodesets │ │ ├── default.yml │ │ └── centos-72-x64.yml │ ├── node_spec.rb │ └── management_spec.rb ├── classes │ ├── management_spec.rb │ └── node_spec.rb ├── spec_helper_acceptance.rb └── spec_helper.rb ├── .fixtures.yml ├── manifests ├── management.pp └── node.pp ├── .travis.yml ├── metadata.json ├── Rakefile ├── Gemfile ├── README.md └── LICENSE /CHANGELOG: -------------------------------------------------------------------------------- 1 | Unreleased 2 | - Adding passthru for Docker env 3 | 4 | Version 1.0.0 5 | - Initial public release. 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .bin/ 2 | .gems/ 3 | Gemfile.lock 4 | spec/fixtures/ 5 | .vagrant/ 6 | pkg/ 7 | .bundle/ 8 | vendor/ 9 | log/ 10 | -------------------------------------------------------------------------------- /spec/acceptance/nodesets/default.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | centos-72-x64: 3 | roles: 4 | - master 5 | platform: el-7-x86_64 6 | box: puppetlabs/centos-7.2-64-nocm 7 | hypervisor: vagrant 8 | CONFIG: 9 | log_level: verbose 10 | type: foss 11 | -------------------------------------------------------------------------------- /spec/acceptance/nodesets/centos-72-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | centos-72-x64: 3 | roles: 4 | - master 5 | platform: el-7-x86_64 6 | box: puppetlabs/centos-7.2-64-nocm 7 | hypervisor: vagrant 8 | CONFIG: 9 | log_level: verbose 10 | type: foss 11 | -------------------------------------------------------------------------------- /.fixtures.yml: -------------------------------------------------------------------------------- 1 | fixtures: 2 | forge_modules: 3 | stdlib: 'puppetlabs-stdlib' 4 | epel: 'stahnma-epel' 5 | docker: 'garethr-docker' 6 | repositories: 7 | apt: 8 | repo: git://github.com/puppetlabs/puppetlabs-apt.git 9 | ref: 2.1.0 10 | symlinks: 11 | rancher: "#{source_dir}" 12 | -------------------------------------------------------------------------------- /manifests/management.pp: -------------------------------------------------------------------------------- 1 | # Management Server. 2 | class rancher::management( 3 | $rancher_manager_port = '8080', 4 | ){ 5 | require docker 6 | 7 | docker::image { 'rancher/server': 8 | } 9 | 10 | docker::run { 'rancher/server': 11 | image => 'rancher/server', 12 | ports => [ "${rancher_manager_port}:8080" ], 13 | require => Docker::Image['rancher/server'], 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /spec/classes/management_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'rancher::management' do 4 | let(:params) {{ 5 | :rancher_manager_port => '8080', 6 | }} 7 | it { 8 | is_expected.to contain_docker__image('rancher/server') 9 | is_expected.to contain_docker__run('rancher/server').with({ 10 | 'image' => 'rancher/server', 11 | 'ports' => ['8080:8080'], 12 | 'require' => 'Docker::Image[rancher/server]' 13 | }) 14 | } 15 | end 16 | -------------------------------------------------------------------------------- /spec/acceptance/node_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper_acceptance' 2 | 3 | describe 'rancher::node' do 4 | context 'puppet apply' do 5 | it 'is expected to apply with no errors' do 6 | pp = <<-EOS 7 | class { 'rancher::node': 8 | management => '10.0.1.1', 9 | registration_token => 'DB121CFBA836F9493653:1434085200000:2ZOwUMd6fIzz44efikGhBP1veo', 10 | } 11 | EOS 12 | 13 | # Run it twice and test for idempotency 14 | apply_manifest(pp, :catch_failures => true) 15 | apply_manifest(pp, :catch_changes => true) 16 | end 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /spec/acceptance/management_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper_acceptance' 2 | 3 | describe 'rancher::management' do 4 | context 'puppet apply' do 5 | it 'is expected to apply and be idempotent' do 6 | pp = <<-EOS 7 | class { 'rancher::management': 8 | rancher_manager_port => '8080', 9 | } 10 | EOS 11 | 12 | apply_manifest(pp, :catch_failures => true) 13 | apply_manifest(pp, :catch_changes => true) 14 | end 15 | end 16 | 17 | describe docker_image('rancher/server') do 18 | it { is_expected.to exist } 19 | end 20 | 21 | describe command('curl 0.0.0.0:8080') do 22 | it { 23 | sleep 60 # Give Rancher time to start. 24 | expect(subject.stdout).to match /self.*0.0.0.0:8080/ 25 | } 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /manifests/node.pp: -------------------------------------------------------------------------------- 1 | # Register Docker Node. 2 | class rancher::node ( 3 | $management, 4 | $registration_token, 5 | $rancher_master_port = 8080, 6 | $docker_env = [] 7 | ) { 8 | validate_string($management) 9 | validate_string($registration_token) 10 | 11 | require docker 12 | 13 | docker::image { 'rancher/agent': 14 | } 15 | 16 | docker::run { 'rancher/node': 17 | image => 'rancher/agent', 18 | privileged => true, 19 | command => "http://${management}:${rancher_master_port}/v1/scripts/${registration_token}", 20 | volumes => [ 21 | '/var/run/docker.sock:/var/run/docker.sock', 22 | '/var/lib/rancher:/var/lib/rancher' 23 | ], 24 | require => Docker::Image['rancher/agent'], 25 | env => $docker_env 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | language: ruby 3 | bundler_args: --without development 4 | before_install: rm Gemfile.lock || true 5 | matrix: 6 | fast_finish: true 7 | include: 8 | - rvm: 2.1.5 9 | env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER=yes 10 | - rvm: 2.1.5 11 | env: PUPPET_GEM_VERSION="~> 3.0" 12 | - rvm: 1.9.3 13 | env: PUPPET_GEM_VERSION="~> 3.0" 14 | - rvm: 2.1.6 15 | env: PUPPET_GEM_VERSION="~> 4.1.0" STRICT_VARIABLES=yes 16 | - rvm: 2.1.6 17 | env: PUPPET_GEM_VERSION="~> 4.2.0" STRICT_VARIABLES=yes 18 | - rvm: 2.1.6 19 | env: PUPPET_GEM_VERSION="~> 4.3.0" STRICT_VARIABLES=yes 20 | - rvm: 2.1.6 21 | env: PUPPET_GEM_VERSION="~> 4.0" STRICT_VARIABLES=yes 22 | script: "bundle exec rake validate && bundle exec rake lint && bundle exec rake spec SPEC_OPTS='--format documentation'" 23 | notifications: 24 | email: false 25 | -------------------------------------------------------------------------------- /spec/classes/node_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'rancher::node' do 4 | context 'with valid options' do 5 | let(:params) {{ 6 | :management => '10.0.1.1', 7 | :registration_token => 'DB121CFBA836F9493653:1434085200000:2ZOwUMd6fIzz44efikGhBP1veo', 8 | }} 9 | it { 10 | is_expected.to contain_docker__image('rancher/agent') 11 | is_expected.to contain_docker__run('rancher/node').with({ 12 | 'image' => 'rancher/agent', 13 | 'command' => 'http://10.0.1.1:8080/v1/scripts/DB121CFBA836F9493653:1434085200000:2ZOwUMd6fIzz44efikGhBP1veo', 14 | 'volumes' => [ 15 | '/var/run/docker.sock:/var/run/docker.sock', 16 | '/var/lib/rancher:/var/lib/rancher', 17 | ], 18 | 'require' => 'Docker::Image[rancher/agent]' 19 | }) 20 | } 21 | end 22 | 23 | context 'with invalid options' do 24 | let(:params) {{ 25 | }} 26 | it { is_expected.to_not compile } 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nick-rancher", 3 | "version": "1.0.0", 4 | "author": "Nick Schuch", 5 | "summary": "Deploy Rancher, a container orchestration tool", 6 | "license": "Apache-2.0", 7 | "source": "https://github.com/nickschuch/puppet-rancher", 8 | "project_page": "https://github.com/nickschuch/puppet-rancher", 9 | "issues_url": "https://github.com/nickschuch/puppet-rancher/issues", 10 | "dependencies": [ 11 | { 12 | "name": "puppetlabs-stdlib", 13 | "version_requirement": ">= 3.2.0 < 5.0.0" 14 | }, 15 | { 16 | "name": "garethr-docker", 17 | "version_requirement": ">= 5.0.0" 18 | } 19 | ], 20 | "operatingsystem_support": [ 21 | { 22 | "operatingsystem": "Debian", 23 | "operatingsystemrelease": [ 24 | "6", 25 | "7" 26 | ] 27 | }, 28 | { 29 | "operatingsystem": "RedHat", 30 | "operatingsystemrelease": [ 31 | "5", 32 | "6", 33 | "7" 34 | ] 35 | } 36 | ], 37 | "tags": [ 38 | "rancher", 39 | "docker", 40 | "containers" 41 | ] 42 | } 43 | -------------------------------------------------------------------------------- /spec/spec_helper_acceptance.rb: -------------------------------------------------------------------------------- 1 | require 'beaker-rspec' 2 | 3 | UNSUPPORTED_PLATFORMS = [ 'Windows', 'Solaris', 'AIX' ] 4 | 5 | unless ENV['RS_PROVISION'] == 'no' or ENV['BEAKER_provision'] == 'no' 6 | # This will install the latest available package on el and deb based 7 | # systems fail on windows and osx, and install via gem on other *nixes 8 | foss_opts = { :default_action => 'gem_install' } 9 | 10 | if default.is_pe?; then install_pe; else install_puppet( foss_opts ); end 11 | 12 | hosts.each do |host| 13 | on hosts, "mkdir -p #{host['distmoduledir']}" 14 | end 15 | end 16 | 17 | RSpec.configure do |c| 18 | # Project root 19 | proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) 20 | 21 | # Readable test descriptions 22 | c.formatter = :documentation 23 | 24 | # Configure all nodes in nodeset 25 | c.before :suite do 26 | shell("/bin/yum update lvm2 -y") 27 | puppet_module_install(:source => proj_root, :module_name => 'rancher') 28 | hosts.each do |host| 29 | # List other dependencies here so they are installed on the host 30 | on host, puppet('module','install','puppetlabs-stdlib'), { :acceptable_exit_codes => [0] } 31 | on host, puppet('module','install','garethr-docker'), { :acceptable_exit_codes => [0] } 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require 'puppetlabs_spec_helper/rake_tasks' 2 | require 'puppet-lint/tasks/puppet-lint' 3 | require 'puppet-syntax/tasks/puppet-syntax' 4 | 5 | # These two gems aren't always present, for instance 6 | # on Travis with --without development 7 | begin 8 | require 'puppet_blacksmith/rake_tasks' 9 | Blacksmith::RakeTask.new do |t| 10 | t.tag_pattern = 'v%s' # Use a custom pattern with git tag. %s is replaced with the version number. 11 | end 12 | rescue LoadError 13 | end 14 | 15 | PuppetLint.configuration.relative = true 16 | PuppetLint.configuration.send('disable_80chars') 17 | PuppetLint.configuration.log_format = '%{path}:%{linenumber}:%{check}:%{KIND}:%{message}' 18 | PuppetLint.configuration.fail_on_warnings = true 19 | 20 | # Forsake support for Puppet 2.6.2 for the benefit of cleaner code. 21 | # http://puppet-lint.com/checks/class_parameter_defaults/ 22 | PuppetLint.configuration.send('disable_class_parameter_defaults') 23 | # http://puppet-lint.com/checks/class_inherits_from_params_class/ 24 | PuppetLint.configuration.send('disable_class_inherits_from_params_class') 25 | 26 | exclude_paths = [ 27 | 'pkg/**/*', 28 | 'vendor/**/*', 29 | 'spec/**/*', 30 | ] 31 | PuppetLint.configuration.ignore_paths = exclude_paths 32 | PuppetSyntax.exclude_paths = exclude_paths 33 | 34 | desc 'Run syntax, lint, and spec tests.' 35 | task :test => [:syntax, :lint, :spec, :metadata_lint] 36 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'puppetlabs_spec_helper/module_spec_helper' 2 | 3 | fixture_path = File.expand_path(File.join(__FILE__, '..', 'fixtures')) 4 | 5 | RSpec.configure do |c| 6 | c.module_path = File.join(fixture_path, 'modules') 7 | c.manifest_dir = File.join(fixture_path, 'manifests') 8 | 9 | # below is the facts hash that gives you the ability to mock 10 | # facts on a per describe/context block. If you use a fact in your 11 | # manifest you should mock the facts below. 12 | 13 | c.default_facts = { 14 | :osfamily => 'RedHat', 15 | :operatingsystem => 'CentOS', 16 | :operatingsystemrelease => '7.2', 17 | :operatingsystemmajrelease => '7', 18 | :kernelversion => '3.10.0', 19 | :kernelrelease => '3.10.0-327.el7.x86_64', 20 | } 21 | 22 | # add these two lines in a single test block to enable puppet and hiera debug mode 23 | 24 | # Puppet::Util::Log.level = :debug 25 | # Puppet::Util::Log.newdestination(:console) 26 | 27 | # by default the hiera integration uses hiera data from the shared_contexts.rb file 28 | # but basically to mock hiera you first need to add a key/value pair 29 | # to the specific context in the spec/shared_contexts.rb file 30 | # Note: you can only use a single hiera context per describe/context block 31 | # rspec-puppet does not allow you to swap out hiera data on a per test block 32 | 33 | # include_context :hiera 34 | 35 | end 36 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source ENV['GEM_SOURCE'] || "https://rubygems.org" 2 | 3 | def location_for(place, version = nil) 4 | if place =~ /^(git[:@][^#]*)#(.*)/ 5 | [version, {:git => $1, :branch => $2, :require => false}].compact 6 | elsif place =~ /^file:\/\/(.*)/ 7 | ['>= 0', {:path => File.expand_path($1), :require => false}] 8 | else 9 | [place, version, {:require => false}].compact 10 | end 11 | end 12 | 13 | group :development, :unit_tests do 14 | gem 'json', :require => false 15 | gem 'metadata-json-lint', :require => false 16 | gem 'puppet_facts', :require => false 17 | gem 'puppet-blacksmith', :require => false 18 | gem 'puppetlabs_spec_helper', :require => false 19 | gem 'rspec-puppet', '>= 2.3.2', :require => false 20 | gem 'simplecov', :require => false 21 | end 22 | 23 | group :system_tests do 24 | gem 'beaker-rspec', *location_for(ENV['BEAKER_RSPEC_VERSION'] || '>= 3.4') 25 | gem 'beaker', *location_for(ENV['BEAKER_VERSION']) 26 | gem 'serverspec', :require => false 27 | gem 'beaker-puppet_install_helper', :require => false 28 | gem 'master_manipulator', :require => false 29 | gem 'beaker-hostgenerator', *location_for(ENV['BEAKER_HOSTGENERATOR_VERSION']) 30 | end 31 | 32 | gem 'facter', *location_for(ENV['FACTER_GEM_VERSION']) 33 | gem 'puppet', *location_for(ENV['PUPPET_GEM_VERSION']) 34 | 35 | if File.exists? "#{__FILE__}.local" 36 | eval(File.read("#{__FILE__}.local"), binding) 37 | end 38 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Puppet - Rancher 2 | ================ 3 | 4 | [![Build Status](https://travis-ci.org/nickschuch/puppet-rancher.svg?branch=master)](https://travis-ci.org/nickschuch/puppet-rancher) 5 | 6 | ## Overview 7 | 8 | A manifest with the goal of aiding setup of the Rancher projects. 9 | 10 | https://github.com/rancherio/rancher 11 | 12 | ## Puppet Forge 13 | 14 | https://forge.puppetlabs.com/nick/rancher 15 | 16 | ## Demo manifest 17 | 18 | https://github.com/nickschuch/puppet-rancher-demo 19 | 20 | ## Usage 21 | 22 | Management node 23 | 24 | ```puppet 25 | include rancher::management 26 | ``` 27 | 28 | Docker Node 29 | 30 | ```puppet 31 | rancher::node { 'example_node': 32 | management => '10.0.1.2', 33 | registration_token => '5074AF5E431560691B8F1457978400000:UZRKUYcESSHKpOTERoOPPor7QY', 34 | } 35 | ``` 36 | 37 | To add a Docker Node on the Management server 38 | 39 | ```puppet 40 | rancher::node { 'manager_node': 41 | management => '10.0.1.2', 42 | registration_token => '5074AF5E431560691B8F1457978400000:UZRKUYcESSHKpOTERoOPPor7QY', 43 | docker_env => ["CATTLE_AGENT_IP=${::ipaddress}"] 44 | } 45 | ``` 46 | 47 | ## Requirements 48 | 49 | We require the following Puppet modules. 50 | 51 | * https://forge.puppetlabs.com/garethr/docker 52 | * https://forge.puppetlabs.com/puppetlabs/stdlib 53 | 54 | ## Testing 55 | 56 | To run the tests: 57 | 58 | ``` 59 | gem install bundler 60 | bundle install 61 | bundle exec rake test 62 | export BEAKER_destroy=no 63 | bundle exec rspec spec/acceptance 64 | ``` 65 | 66 | ## Thanks 67 | 68 | A big thanks goes out to the contributors of the required Puppet modules and also the Rancher team. 69 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | --------------------------------------------------------------------------------