sambot 0.1.184 → 0.1.185

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3e71a9be06098e06cf9ece4994cc612b6bbe90c3
4
- data.tar.gz: 75057abc94f0426a275e81688b0e224113373724
3
+ metadata.gz: 8d675645367588e60d53110037db46869d57de7b
4
+ data.tar.gz: 9a39bf623bec6708de2b26d0551353a8e45e9e77
5
5
  SHA512:
6
- metadata.gz: 83ac3d0b048af4024ee7eba7b443cb45738c5d6e1a92628610cd148d97c701f27f03b79c6ff940ccc79d9270f590b3e332636011840d669202b95b7537f9e016
7
- data.tar.gz: 5b12090622c58d9a562cdc58fe97011fb24292121b81870db60a455d36d0b7d19560a8ee23d5f259bd03891469b2b484849f782c00523f6c7c2c647f6f373640
6
+ metadata.gz: badfa93e6c8101e736b0941c430c4f2177945e0a93ef449e704ceba66ae673d7354f1c16e46ea761e2a0159ec933958ae6f5cc8a34966ff6c76b985e5200f40b
7
+ data.tar.gz: 34aa0d4396aad5b70a750923f0600bb450680100531e82054e8c1480f23422531ad05acf38429549bb6932565941ea60abd68f6975d38a51c2edfaf06ad310b7
@@ -1,3 +1,5 @@
1
+ require 'sambot'
2
+
1
3
  <% config[:vagrantfiles].each do |vagrantfile| %>
2
4
  require "<%= vagrantfile %>"
3
5
  <% end %>
@@ -86,8 +88,13 @@ Vagrant.configure("2") do |c|
86
88
  c.vm.synced_folder <%= source.inspect %>, <%= destination.inspect %>, <%= options %>
87
89
  <% end %>
88
90
 
91
+ #################################################################################
92
+ # The steps below run the bootstrap script for th newly created boxes. #
93
+ # As part of the bootstrapping, a wrapped token is generated and given to #
94
+ # bootstrap script. #
95
+ #################################################################################
89
96
  <% if config[:box] =~ /centos/ %>
90
- c.vm.provision "shell", inline: "bash /vagrant/bootstrap.sh"
97
+ c.vm.provision "shell", inline: "bash /vagrant/bootstrap.sh <%= ::Sambot::Testing::VaultHelper.generate_wrapped_token %>"
91
98
  <% else %>
92
99
  c.vm.provision "shell", inline: "powershell -ExecutionPolicy Bypass -File C:/Vagrant/bootstrap.ps1"
93
100
  <% end %>
@@ -28,7 +28,7 @@
28
28
  # #
29
29
  #################################################################################
30
30
 
31
- yum install -y unzip
31
+ yum install -y unzip wget
32
32
 
33
33
  #################################################################################
34
34
  # Download and install Hashicorp Vault. #
@@ -12,6 +12,20 @@ module Sambot
12
12
  WORKING_DIR = '/tmp/sambot/testing/vault'
13
13
  VAULT_POLICIES_REPO = 'git@github.exacttarget.com:ads-devops/vault-policies.git'
14
14
 
15
+ def generate_wrapped_token
16
+ ::Vault.configure do |config|
17
+ config.address = 'http://127.0.0.1:8200'
18
+ config.token = 'root'
19
+ config.ssl_verify = false
20
+ end
21
+ token = ''
22
+ begin
23
+ token = Vault.auth_token.create(wrap_ttl: "72h", role: 'nightswatch-ro', policy: 'nightswatch-ro').wrap_info.token
24
+ rescue
25
+ end
26
+ token
27
+ end
28
+
15
29
  def setup
16
30
  FileUtils.rm_r(WORKING_DIR) if Dir.exist?(WORKING_DIR)
17
31
  FileUtils.mkpath WORKING_DIR
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sambot
4
- VERSION = '0.1.184'.freeze
4
+ VERSION = '0.1.185'.freeze
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sambot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.184
4
+ version: 0.1.185
5
5
  platform: ruby
6
6
  authors:
7
7
  - Olivier Kouame
@@ -429,7 +429,6 @@ files:
429
429
  - lib/sambot/templates/test_kitchen/local.yml.erb
430
430
  - lib/sambot/templates/test_kitchen/rackspace.yml.erb
431
431
  - lib/sambot/templates/vault-config
432
- - lib/sambot/templates/vault_helper.rb
433
432
  - lib/sambot/templates/winrm_config
434
433
  - lib/sambot/testing/consul_helper.rb
435
434
  - lib/sambot/testing/fixtures.rb
@@ -1,35 +0,0 @@
1
- require 'yaml'
2
- require 'vault'
3
-
4
- def info(msg)
5
- puts msg
6
- end
7
-
8
- def read_secrets(filename)
9
- info("Reading the secrets file at '.vault.yml'")
10
- contents = File.read(filename)
11
- if contents.empty?
12
- info("No secrets were found in the '.vault.yml' secrets file")
13
- else
14
- store_secrets(contents)
15
- end
16
- end
17
-
18
- def store_secrets(contents)
19
- secrets = YAML.load(contents)
20
- secrets.each { |secret| store_secret(secret) }
21
- end
22
-
23
- def store_secret(secret)
24
- data = secret['contents']
25
- data = File.read(data.gsub(/file::/, '')) if data.start_with?('file::')
26
- Vault.logical.write(secret['path'], value: data)
27
- puts "Updated the secret located at #{secret['path']}"
28
- end
29
-
30
- filename = File.expand_path(File.join(File.dirname(__FILE__), '../../.vault.yml'))
31
- if File.exist?(filename)
32
- read_secrets(filename)
33
- else
34
- info("No '.vault.yml' file is available so Vault was not populated with any secrets")
35
- end