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 +4 -4
- data/README.md +6 -9
- data/lib/sambot/developer_workflow/dns.rb +1 -1
- data/lib/sambot/developer_workflow/session.rb +6 -1
- data/lib/sambot/developer_workflow/vault.rb +23 -14
- data/lib/sambot/version.rb +1 -1
- metadata +20 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f107e9b5776ea6086c95712934150c1de36f1c50
|
4
|
+
data.tar.gz: 85c0d6f34327f86a55815fde3fad5ff7bccaffc9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
3
|
+
Sambot is our internal Platform Engineering toolchain to help standardize and simplify our DevOps workflow.
|
4
4
|
|
5
|
-
It
|
6
|
-
|
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
|
-
|
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
|
-
|
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 =
|
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 =
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
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(
|
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
|
data/lib/sambot/version.rb
CHANGED
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.
|
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-
|
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:
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
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:
|