sambot 0.1.106 → 0.1.107

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: 421762a59494d4a4c050140ac6d71b8d64e6315c
4
- data.tar.gz: eb328554099dc00c8fde40df17ac9f2ffef092f9
3
+ metadata.gz: f107e9b5776ea6086c95712934150c1de36f1c50
4
+ data.tar.gz: 85c0d6f34327f86a55815fde3fad5ff7bccaffc9
5
5
  SHA512:
6
- metadata.gz: 4d3c709ddd1bb57b11c1017ced553fb9b171233ab8cd1255b5af68cb5388d841bc3edce7e3516923d29f483554a46886c8c3de9ab975ee8de9fa889e9986db2e
7
- data.tar.gz: a199de6c29a764a478ee4cacea3a485c00d77b7f1bf05273e9c1b17faaf08ba912302d15b8a65aca14b4fdc5b64b87964dbb3e488d15ffa6d409b32a7daafb86
6
+ metadata.gz: 702e3d8c1b4acd76559de55a44a78d991a471015a8b389627626d75da7f048cbaf9702a44c016831c5ba45a78c48a203c4b483b3e52254a82a67135d7d7f2879
7
+ data.tar.gz: 8ebe2e043d1d73efe5bf07f9650df3d7ba1e54c54152c0690b13debabbc5163a8fb48235114cf7a420e40021d91d3f30f49b1ef9ee6c5dedb26115780c2e0f00
data/README.md CHANGED
@@ -1,19 +1,16 @@
1
1
  # Sambot
2
2
 
3
- Sambot is our internal Platform Engineering gem to help standardize and simplify our DevOps workflow.
3
+ Sambot is our internal Platform Engineering toolchain to help standardize and simplify our DevOps workflow.
4
4
 
5
- It can be used both as a library - to read secrets from Hashicorp Vault in a Chef cookbook for example - or as an
6
- executable to guide tasks such as managing Chef cookbooks.
5
+ It provides an executable with a variety of commands, grouped in various areas of functionality such as session management,
6
+ DNS changes and cookbook management.
7
7
 
8
8
  ## Usage
9
9
 
10
- To install the gem, simply run `gem install sambot`.
10
+ To install the gem, simply run `chef gem install sambot`. This will install the gem in your ChefDK installation.
11
11
 
12
- Run `sambot` to be shown the help menu.
13
-
14
- ## Available Commands
15
-
16
- To view the list of available commands and their descriptions, refer to the files in lib/sambot/commands.
12
+ Run `chef exec sambot` to be shown the help menu. For help on specific commands, i.e. cookbook management and specific
13
+ cookbook management commands, run `chef exec sambot help cookbook` or `chef exec sambot cookbook help generate` for example.
17
14
 
18
15
  ## Contributing
19
16
 
@@ -23,7 +23,7 @@ module Sambot
23
23
  hosts = Hosts::File.read(src)
24
24
  entries = hosts.elements
25
25
  forwards.each do |key, value|
26
- entries.delete_if { |entry| entry.is_a?(Aef::Hosts::Entry) && entry.name == key}
26
+ entries.delete_if { |entry| entry.is_a?(Aef::Hosts::Entry) && entry.name == key.to_s}
27
27
  yield(entries, key, value) if block_given?
28
28
  end
29
29
  hosts.write
@@ -33,7 +33,7 @@ module Sambot
33
33
  end
34
34
  setup_networking
35
35
  start_daemon_for_tunneling(username, password)
36
- #setup_secrets_management(username, password)
36
+ setup_secrets_management(username, password)
37
37
  UI.info("Your session has now started. Run `sambot session stop` to close it.")
38
38
  end
39
39
 
@@ -73,6 +73,11 @@ module Sambot
73
73
  end
74
74
 
75
75
  def setup_secrets_management(username, password)
76
+ Vault.setup_environment('vault.brighter.io', FORWARDS['vault.brighter.io'.to_sym][:port], '/etc/profile.d/')
77
+ unless Vault.has_environment_variables?('/etc/profile.d/')
78
+ Vault.dump_environment('sambot.env')
79
+ UI.info("Because this is the first time you have created a session, environment variables need to be set. Run `source sambot.env` to add them this session - future sessions won't need this step.")
80
+ end
76
81
  UI.debug "Authenticating with Hashicorp Vault in Rackspace DEV/QE..."
77
82
  token = Vault.authenticate(username, password)
78
83
  UI.debug "Saving your Vault authentication token to ~/.vault-token..."
@@ -6,27 +6,36 @@ module Sambot
6
6
  module DeveloperWorkflow
7
7
  class Vault
8
8
 
9
- ENVIRONMENT_VARIABLES = {
10
- VAULT_ADDR: 'https://localhost:8200',
11
- VAULT_SKIP_VERIFY: true
12
- }
13
-
14
- ENV_ROOT = '/etc/profile.d/'
9
+ TARGET = "https://vault.brighter.io:8200"
15
10
 
16
11
  def self.authenticate(username, password)
17
- secret = ::Vault.auth.ldap(username, password)
12
+ secret = nil
13
+ ::Vault.configure do |config|
14
+ sleep(3)
15
+ config.address = TARGET
16
+ config.ssl_verify = false
17
+ secret = ::Vault.auth.ldap(username, password)
18
+ end
18
19
  secret.auth.client_token
19
20
  end
20
21
 
21
- def self.setup_environment(root = ENV_ROOT)
22
- ENVIRONMENT_VARIABLES.each_pair do |key, value|
23
- path = File.join(root, "#{key}.sh")
24
- File.write(path, "export #{key}=#{value}")
25
- end
22
+ def self.setup_environment(host, port, root = '/etc/profile.d/')
23
+ save_environment_variable('VAULT_SKIP_VERIFY', true)
24
+ save_environment_variable('VAULT_ADDR', TARGET)
25
+ end
26
+
27
+ def self.save_environment_variable(key, value, path = '/etc/profile.d/')
28
+ path = File.join(path, "#{key}.sh")
29
+ File.write(path, "export #{key}=#{value}")
30
+ ENV[key] = value.to_s
31
+ end
32
+
33
+ def self.has_environment_variables?(path)
34
+ File.exist?(File.join(path, "VAULT_SKIP_VERIFY.sh")) && File.exist?(File.join(path, "VAULT_ADDR.sh"))
26
35
  end
27
36
 
28
- def self.save_token(token)
29
- File.write("~/.vault-token", token)
37
+ def self.save_token(token, home_directory = '~')
38
+ File.write(File.expand_path(File.join(home_directory, '.vault-token')), token)
30
39
  end
31
40
 
32
41
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sambot
4
- VERSION = '0.1.106'.freeze
4
+ VERSION = '0.1.107'.freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sambot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.106
4
+ version: 0.1.107
5
5
  platform: ruby
6
6
  authors:
7
7
  - Olivier Kouame
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-13 00:00:00.000000000 Z
11
+ date: 2017-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor-hollaback
@@ -358,14 +358,24 @@ dependencies:
358
358
  - - "~>"
359
359
  - !ruby/object:Gem::Version
360
360
  version: '3.0'
361
- description: "# Sambot\n\nSambot is our internal Platform Engineering gem to help
362
- standardize and simplify our DevOps workflow.\n\nIt can be used both as a library
363
- - to read secrets from Hashicorp Vault in a Chef cookbook for example - or as an\nexecutable
364
- to guide tasks such as managing Chef cookbooks.\n\n## Usage\n\nTo install the gem,
365
- simply run `gem install sambot`.\n\nRun `sambot` to be shown the help menu.\n\n##
366
- Available Commands\n\nTo view the list of available commands and their descriptions,
367
- refer to the files in lib/sambot/commands. \n\n## Contributing\n\nBug reports and
368
- pull requests are welcome on GitHub at https://github.exacttarget.com/ads-devops/sambot.\n"
361
+ description: |
362
+ # Sambot
363
+
364
+ Sambot is our internal Platform Engineering toolchain to help standardize and simplify our DevOps workflow.
365
+
366
+ It provides an executable with a variety of commands, grouped in various areas of functionality such as session management,
367
+ DNS changes and cookbook management.
368
+
369
+ ## Usage
370
+
371
+ To install the gem, simply run `chef gem install sambot`. This will install the gem in your ChefDK installation.
372
+
373
+ Run `chef exec sambot` to be shown the help menu. For help on specific commands, i.e. cookbook management and specific
374
+ cookbook management commands, run `chef exec sambot help cookbook` or `chef exec sambot cookbook help generate` for example.
375
+
376
+ ## Contributing
377
+
378
+ Bug reports and pull requests are welcome on GitHub at https://github.exacttarget.com/ads-devops/sambot.
369
379
  email:
370
380
  - olivier.kouame@gmail.com
371
381
  executables: