diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..febee30 --- /dev/null +++ b/.gitignore @@ -0,0 +1,21 @@ +.vagrant +*~ +*# +.#* +\#*# +.*.sw[a-z] +*.un~ + +# Bundler +Gemfile.lock +bin/* +.bundle/* + +# test kitchen +.kitchen/ +.kitchen.local.yml + +# Chef +Berksfile.lock +.zero-knife.rb +Policyfile.lock.json diff --git a/.kitchen.yml b/.kitchen.yml index 3a9402d..bfae30e 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -7,7 +7,6 @@ provisioner: platforms: - name: centos-6.7 - name: centos-7.2 - - name: ubuntu-12.04 - name: ubuntu-14.04 - name: ubuntu-16.04 diff --git a/Berksfile b/Berksfile index 66b9869..33d182b 100644 --- a/Berksfile +++ b/Berksfile @@ -5,7 +5,7 @@ metadata cookbook 'yum' cookbook 'chef-sugar', '~>3.0.1' cookbook 'line' -cookbook 'python' +cookbook 'poise-python' cookbook 'apt' cookbook 'citadel', diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index f699207..0000000 --- a/Gemfile.lock +++ /dev/null @@ -1,245 +0,0 @@ -GIT - remote: git://github.com/berkshelf/berkshelf.git - revision: eabb03a7a87f3ffa19bd1024ce7b71e4ade792db - specs: - berkshelf (3.0.0.rc1) - addressable (~> 2.3.4) - berkshelf-api-client (~> 1.2.0.rc2) - buff-config (~> 0.2) - buff-extensions (~> 0.4) - buff-shell_out (~> 0.1) - faraday (~> 0.9.0) - minitar (~> 0.5.4) - octokit (~> 2.6) - retryable (~> 1.3.3) - ridley (~> 3.0) - solve (~> 1.0.0.rc3) - thor (~> 0.18) - -GEM - remote: http://rubygems.org/ - specs: - addressable (2.3.6) - ast (1.1.0) - berkshelf-api-client (1.2.0.rc2) - faraday (~> 0.9.0) - buff-config (0.4.0) - buff-extensions (~> 0.3) - varia_model (~> 0.1) - buff-extensions (0.5.0) - buff-ignore (1.1.1) - buff-ruby_engine (0.1.0) - buff-shell_out (0.1.1) - buff-ruby_engine (~> 0.1.0) - celluloid (0.16.0.pre) - timers (~> 2.0.0) - celluloid-io (0.16.0.pre) - celluloid (>= 0.16.0.pre) - nio4r (>= 1.0.0) - chef (11.12.2) - chef-zero (~> 2.0, >= 2.0.2) - diff-lcs (~> 1.2, >= 1.2.4) - erubis (~> 2.7) - highline (~> 1.6, >= 1.6.9) - json (>= 1.4.4, <= 1.8.1) - mime-types (~> 1.16) - mixlib-authentication (~> 1.3) - mixlib-cli (~> 1.4) - mixlib-config (~> 2.0) - mixlib-log (~> 1.3) - mixlib-shellout (~> 1.4) - net-ssh (~> 2.6) - net-ssh-multi (~> 1.1) - ohai (~> 7.0) - pry (~> 0.9) - rest-client (>= 1.0.4, < 1.7.0) - yajl-ruby (~> 1.1) - chef-sugar (1.2.6) - chef-zero (2.0.2) - hashie (~> 2.0) - json - mixlib-log (~> 1.3) - rack - chefspec (3.4.0) - chef (~> 11.0) - fauxhai (~> 2.0) - rspec (~> 2.14) - coderay (1.1.0) - dep-selector-libgecode (1.0.0.rc.1) - dep_selector (1.0.0.rc.2) - dep-selector-libgecode (~> 1.0.0.rc) - ffi (~> 1.9) - diff-lcs (1.2.5) - erubis (2.7.0) - faraday (0.9.0) - multipart-post (>= 1.2, < 3) - fauxhai (2.1.0) - net-ssh - ohai - ffi (1.9.3) - foodcritic (3.0.3) - erubis - gherkin (~> 2.11.7) - nokogiri (~> 1.5.4) - rake - treetop (~> 1.4.10) - yajl-ruby (~> 1.1.0) - formatador (0.2.4) - gherkin (2.11.8) - multi_json (~> 1.3) - guard (2.6.0) - formatador (>= 0.2.4) - listen (~> 2.7) - lumberjack (~> 1.0) - pry (>= 0.9.12) - thor (>= 0.18.1) - guard-foodcritic (1.0.2) - foodcritic (>= 1.3, < 4.0) - guard (>= 1.0, < 3.0) - guard-kitchen (0.0.2) - guard - mixlib-shellout - guard-rspec (4.2.8) - guard (~> 2.1) - rspec (>= 2.14, < 4.0) - guard-rubocop (1.0.2) - guard (~> 2.0) - rubocop (~> 0.10) - hashie (2.1.1) - highline (1.6.21) - hitimes (1.2.1) - ipaddress (0.8.0) - json (1.8.1) - kitchen-vagrant (0.14.0) - test-kitchen (~> 1.0) - listen (2.7.1) - celluloid (>= 0.15.2) - celluloid-io (>= 0.15.0) - rb-fsevent (>= 0.9.3) - rb-inotify (>= 0.9) - lumberjack (1.0.5) - method_source (0.8.2) - mime-types (1.25.1) - minitar (0.5.4) - mixlib-authentication (1.3.0) - mixlib-log - mixlib-cli (1.4.0) - mixlib-config (2.1.0) - mixlib-log (1.6.0) - mixlib-shellout (1.4.0) - multi_json (1.9.2) - multipart-post (2.0.0) - net-http-persistent (2.9.4) - net-scp (1.2.0) - net-ssh (>= 2.6.5) - net-ssh (2.8.0) - net-ssh-gateway (1.2.0) - net-ssh (>= 2.6.5) - net-ssh-multi (1.2.0) - net-ssh (>= 2.6.5) - net-ssh-gateway (>= 1.2.0) - nio4r (1.0.0) - nokogiri (1.5.11) - octokit (2.7.2) - sawyer (~> 0.5.2) - ohai (7.0.2) - ipaddress - mime-types (~> 1.16) - mixlib-cli - mixlib-config (~> 2.0) - mixlib-log - mixlib-shellout (~> 1.2) - systemu (~> 2.5.2) - yajl-ruby - parser (2.1.7) - ast (~> 1.1) - slop (~> 3.4, >= 3.4.5) - polyglot (0.3.4) - powerpack (0.0.9) - pry (0.9.12.6) - coderay (~> 1.0) - method_source (~> 0.8) - slop (~> 3.4) - rack (1.5.2) - rainbow (2.0.0) - rake (10.2.2) - rb-fsevent (0.9.4) - rb-inotify (0.9.3) - ffi (>= 0.5.0) - rest-client (1.6.7) - mime-types (>= 1.16) - retryable (1.3.5) - ridley (3.0.0) - addressable - buff-config (~> 0.2) - buff-extensions (~> 0.3) - buff-ignore (~> 1.1) - buff-shell_out (~> 0.1) - celluloid (~> 0.16.0.pre) - celluloid-io (~> 0.16.0.pre) - erubis - faraday (~> 0.9.0) - hashie (>= 2.0.2) - json (>= 1.7.7) - mixlib-authentication (>= 1.3.0) - net-http-persistent (>= 2.8) - retryable - semverse (~> 1.1) - varia_model (~> 0.3) - rspec (2.14.1) - rspec-core (~> 2.14.0) - rspec-expectations (~> 2.14.0) - rspec-mocks (~> 2.14.0) - rspec-core (2.14.8) - rspec-expectations (2.14.5) - diff-lcs (>= 1.1.3, < 2.0) - rspec-mocks (2.14.6) - rubocop (0.20.1) - json (>= 1.7.7, < 2) - parser (~> 2.1.7) - powerpack (~> 0.0.6) - rainbow (>= 1.99.1, < 3.0) - ruby-progressbar (~> 1.4) - ruby-progressbar (1.4.2) - safe_yaml (1.0.2) - sawyer (0.5.4) - addressable (~> 2.3.5) - faraday (~> 0.8, < 0.10) - semverse (1.1.0) - slop (3.5.0) - solve (1.0.0.rc3) - dep_selector (~> 1.0.0.rc) - semverse (~> 1.1) - systemu (2.5.2) - test-kitchen (1.2.1) - mixlib-shellout (~> 1.2) - net-scp (~> 1.1) - net-ssh (~> 2.7) - safe_yaml (~> 1.0) - thor (~> 0.18) - thor (0.19.1) - timers (2.0.0) - hitimes - treetop (1.4.15) - polyglot - polyglot (>= 0.3.1) - varia_model (0.3.2) - buff-extensions (~> 0.2) - hashie (>= 2.0.2) - yajl-ruby (1.1.0) - -PLATFORMS - ruby - -DEPENDENCIES - berkshelf! - chef-sugar (~> 1.2) - chefspec (>= 3.2) - foodcritic (~> 3.0) - guard (~> 2.6) - guard-foodcritic (~> 1.0) - guard-kitchen (~> 0.0.2) - guard-rspec (~> 4.2) - guard-rubocop (~> 1.0) - kitchen-vagrant (~> 0.14) - test-kitchen (~> 1.2) diff --git a/attributes/default.rb b/attributes/default.rb index 0df90dd..0e590b5 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -1,23 +1,21 @@ case node['platform_family'] when 'debian' - default['openvpnas']['url'] = 'http://swupdate.openvpn.org/as/openvpn-as-2.1.2-Ubuntu12.amd_64.deb' + default['openvpnas']['url'] = 'http://swupdate.openvpn.org/as/openvpn-as-2.5-Ubuntu14.amd_64.deb' case node['platform'] when 'ubuntu' case node['platform_version'].split('.')[0] - when '12' - default['openvpnas']['url'] = 'http://swupdate.openvpn.org/as/openvpn-as-2.1.2-Ubuntu12.amd_64.deb' when '14' - default['openvpnas']['url'] = 'http://swupdate.openvpn.org/as/openvpn-as-2.1.2-Ubuntu14.amd_64.deb' + default['openvpnas']['url'] = 'http://swupdate.openvpn.org/as/openvpn-as-2.5-Ubuntu14.amd_64.deb' when '16' - default['openvpnas']['url'] = 'http://swupdate.openvpn.org/as/openvpn-as-2.1.2-Ubuntu16.amd_64.deb' + default['openvpnas']['url'] = 'http://swupdate.openvpn.org/as/openvpn-as-2.5-Ubuntu16.amd_64.deb' end end when 'rhel' case node['platform_version'].split('.')[0] when '6' - default['openvpnas']['url'] = 'http://swupdate.openvpn.org/as/openvpn-as-2.1.2-CentOS6.x86_64.rpm' + default['openvpnas']['url'] = 'http://swupdate.openvpn.org/as/openvpn-as-2.5-CentOS6.x86_64.rpm' when '7' - default['openvpnas']['url'] = 'http://swupdate.openvpn.org/as/openvpn-as-2.1.2-CentOS7.x86_64.rpm' + default['openvpnas']['url'] = 'http://swupdate.openvpn.org/as/openvpn-as-2.5-CentOS7.x86_64.rpm' end end diff --git a/metadata.rb b/metadata.rb index 6abea07..873cb13 100644 --- a/metadata.rb +++ b/metadata.rb @@ -8,6 +8,6 @@ supports 'redhat' supports 'ubuntu' -%w(apt yum chef-sugar line python citadel).each do |cookbook| +%w(apt yum chef-sugar line poise-python citadel).each do |cookbook| depends cookbook end diff --git a/recipes/backup.rb b/recipes/backup.rb index b7f1a96..c9e5610 100644 --- a/recipes/backup.rb +++ b/recipes/backup.rb @@ -1,6 +1,6 @@ -include_recipe 'python::default' +python_runtime '2.7' -python_pip 'awscli' +python_package 'awscli' template '/usr/local/bin/openvpnas-backup' do source 'openvpnas-backup.erb' diff --git a/recipes/default.rb b/recipes/default.rb index 688f0fa..d67920b 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -55,7 +55,7 @@ end replace_or_add 'sa.company_name' do - path '/usr/local/openvpn_as/as.conf' + path '/usr/local/openvpn_as/etc/as.conf' pattern 'sa.company_name=*' line node['openvpnas']['company_name'] @@ -65,7 +65,7 @@ end replace_or_add 'sa.logo_image_file' do - path '/usr/local/openvpn_as/as.conf' + path '/usr/local/openvpn_as/etc/as.conf' pattern 'sa.logo_image_file=*' line "sa.logo_image_file=#{node['openvpnas']['dir']}/logo.png" diff --git a/recipes/restore.rb b/recipes/restore.rb index 988a8ba..6bea897 100644 --- a/recipes/restore.rb +++ b/recipes/restore.rb @@ -1,6 +1,6 @@ -include_recipe 'python::default' +python_runtime '2.7' -python_pip 'awscli' +python_package 'awscli' template '/usr/local/bin/openvpnas-restore' do source 'openvpnas-restore.erb' diff --git a/templates/default/openvpnas-backup.erb b/templates/default/openvpnas-backup.erb index 1bfb7e4..c6bf775 100644 --- a/templates/default/openvpnas-backup.erb +++ b/templates/default/openvpnas-backup.erb @@ -27,7 +27,6 @@ do done echo 'collecting extra files' cp $OPENVPNAS_DIR/etc/as.conf $BACKUP_DIR -cp $OPENVPNAS_DIR/etc/config.json $BACKUP_DIR cp $OPENVPNAS_DIR/*.png $BACKUP_DIR #archive all backuped up files diff --git a/test/integration/default/serverspec/default_spec.rb b/test/integration/default/serverspec/default_spec.rb index be6d91d..c2b799a 100644 --- a/test/integration/default/serverspec/default_spec.rb +++ b/test/integration/default/serverspec/default_spec.rb @@ -17,7 +17,7 @@ end # as.conf files should has company_name - describe file('/usr/local/openvpn_as/as.conf') do + describe file('/usr/local/openvpn_as/etc/as.conf') do it { should be_file } its(:content) { should match(/.*company_name.*/) } end