train-habitat 0.2.11 → 0.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/train-habitat/version.rb +1 -1
- data/train-habitat.gemspec +1 -1
- metadata +2 -3
- data/README.md +0 -163
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2913079dec63f9db3973d1e38ed65db5be4469da068111b2a59b0c40059851e5
|
4
|
+
data.tar.gz: 697ede6866c1228258de1a7af25a91798f65f0281f3c44590dc62d00995f8e8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa03009352c842b7c4a1a31b18f016f01b58501ffbf8cbc9a7d18ce06206e8dd463e659a5fd958043ca707b059770f1c3b92747fbecfa8dc1c589fc2716a460c
|
7
|
+
data.tar.gz: 25bdf2939a18613da6d0b2f4522e10069bfddcb68a75173f48ca62ab029bc4745162c5f16cd4da3c05fe2fa152ccf5809b9ec525e067b88ba85e784456762578
|
data/train-habitat.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: train-habitat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chef InSpec Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -46,7 +46,6 @@ extensions: []
|
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
48
|
- Gemfile
|
49
|
-
- README.md
|
50
49
|
- lib/train-habitat.rb
|
51
50
|
- lib/train-habitat/connection.rb
|
52
51
|
- lib/train-habitat/httpgateway.rb
|
data/README.md
DELETED
@@ -1,163 +0,0 @@
|
|
1
|
-
# Train-Habitat
|
2
|
-
|
3
|
-
* **Project State: Active**
|
4
|
-
* **Issues Response SLA: 3 business days**
|
5
|
-
* **Pull Request Response SLA: 3 business days**
|
6
|
-
|
7
|
-
For more information on project states and SLAs, see [this documentation](https://github.com/chef/chef-oss-practices/blob/master/repo-management/repo-states.md).
|
8
|
-
|
9
|
-
`train-habitat` is a Train plugin and is used as a Train Transport to connect to Habitat installations.
|
10
|
-
|
11
|
-
## To Install this as a User
|
12
|
-
|
13
|
-
`train-habitat` is included with InSpec 4.7.3 and later. There is no need to separately install this plugin.
|
14
|
-
|
15
|
-
## Using train-habitat from InSpec
|
16
|
-
|
17
|
-
As `train-habitat` takes potentially many options, it is simplest to list the options in your `~/.inspec/config.json` file, then used the named set of options with `-t`.
|
18
|
-
|
19
|
-
For example, if your config file contains:
|
20
|
-
|
21
|
-
```
|
22
|
-
{
|
23
|
-
"file_version": "1.1",
|
24
|
-
"credentials": {
|
25
|
-
"habitat": {
|
26
|
-
"dev-hab": {
|
27
|
-
"api_url": "http://dev-hab.my-corp.io",
|
28
|
-
"cli_ssh_host": "dev-hab.my-corp.io"
|
29
|
-
},
|
30
|
-
"prod-hab": {
|
31
|
-
"api_url": "https://prod-hab.my-corp.io",
|
32
|
-
"api_auth_token": "opensesame"
|
33
|
-
},
|
34
|
-
}
|
35
|
-
}
|
36
|
-
}
|
37
|
-
```
|
38
|
-
|
39
|
-
Using this configuration, you could execute:
|
40
|
-
|
41
|
-
```
|
42
|
-
$ inspec exec some-profile -t habitat://dev-hab
|
43
|
-
# Or
|
44
|
-
$ inspec exec some-profile -t habitat://prod-hab
|
45
|
-
```
|
46
|
-
|
47
|
-
You may also pass `--config some-file.json` to use a config file at a different location.
|
48
|
-
|
49
|
-
See the next section for the full list of options you may use with a `habitat` credential set in your configuration.
|
50
|
-
|
51
|
-
## Using train-habitat from Ruby
|
52
|
-
|
53
|
-
The options that may be passed to `Train.create` are listed below.
|
54
|
-
|
55
|
-
### Dual-mode transport
|
56
|
-
|
57
|
-
Because Habitat exposes some facts by its HTTP Gateway API, and some facts by its CLI tool `hab`, this Train Transport has three modes of operation:
|
58
|
-
|
59
|
-
* Using only the HTTP API (no ability to query packages, but rich ability to query rings)
|
60
|
-
* Using only the `hab` CLI command (limitations TBD)
|
61
|
-
* Using both (full capabilities)
|
62
|
-
|
63
|
-
When creating a `train-habitat` Connection, there are thus two sets of options, prefixed with `api_` and `cli_` respectively. You must provide at least one set.
|
64
|
-
|
65
|
-
### API-Mode options
|
66
|
-
|
67
|
-
API-mode options are used to connect to a Habitat Supervisor running with an exposed HTTP Gateway. They are prefixed with `api_`.
|
68
|
-
|
69
|
-
```ruby
|
70
|
-
Train.create(:habitat, api_url: 'http://my-hab.my-company.io:9631')
|
71
|
-
```
|
72
|
-
|
73
|
-
#### api_url
|
74
|
-
|
75
|
-
Required for API-mode use. This is an HTTP or HTTPS URL that identifies a Supervisor HTTP Gateway. If the port is omitted from the URL, the API standard port of 9631 is assumed; to use port 80, specify it explicitly.
|
76
|
-
|
77
|
-
#### api_auth_token
|
78
|
-
|
79
|
-
The supervisor may be configured to require a [Bearer Token Authorization](https://www.habitat.sh/docs/using-habitat/#monitor-services-through-the-http-api), in which the client and the gateway use a pre-shared secret. Use this option to specify the secret.
|
80
|
-
|
81
|
-
### CLI Mode options
|
82
|
-
|
83
|
-
CLI options are more varied, and are entirely dependent on the underlying transport chosen to reach the CLI. For example, if there were a supported transport named 'radio' that took options 'channel' and 'band', specify them to train-habitat like this:
|
84
|
-
|
85
|
-
```ruby
|
86
|
-
Train.create(:habitat, {cli_radio_band: 'VHF', cli_radio_channel: 23})
|
87
|
-
```
|
88
|
-
|
89
|
-
`train-habitat` identifies the underlying "sub-transport" using the prefixes of the provided options. For example, if you pass an option named `cli_ssh_host`, `train-habitat` will recognize that you intend to use the SSH transport to connect to a location that has access to the `hab` CLI tool.
|
90
|
-
|
91
|
-
You may specify many options referring to the same sub-transport (such as credentials), but it is an error to specify more than one CLI sub-transport.
|
92
|
-
|
93
|
-
Currently supported CLI transports include:
|
94
|
-
* SSH
|
95
|
-
|
96
|
-
Plans for future support include (in approximate order):
|
97
|
-
* WinRM
|
98
|
-
* Local
|
99
|
-
* Docker
|
100
|
-
|
101
|
-
#### General Options
|
102
|
-
|
103
|
-
Any options not prefixed with `cli_` or `api_` are also passed to the CLI transport. This means you can use generic Train connection options such as the `sudo` and `shell` sets of options (see [train source code](https://github.com/inspec/train/blob/71679307903fc8853e09abd93f3901c83800e019/lib/train/extras/command_wrapper.rb#L31)), as well as `logger`.
|
104
|
-
|
105
|
-
#### SSH Options
|
106
|
-
|
107
|
-
`train-habitat` can accept any option that the Train SSH Transport accepts if the prefix `cli_ssh_` is added. This includes:
|
108
|
-
|
109
|
-
* `cli_ssh_host` - String hostname or IP address
|
110
|
-
* `cli_ssh_user` - String user to connect as
|
111
|
-
* `cli_ssh_key_files` - Array of paths to private key files to use
|
112
|
-
|
113
|
-
Other options are available; see [train source code](https://github.com/inspec/train/blob/71679307903fc8853e09abd93f3901c83800e019/lib/train/transports/ssh.rb#L45) for details.
|
114
|
-
|
115
|
-
## Development
|
116
|
-
|
117
|
-
### Testing
|
118
|
-
```
|
119
|
-
# Install development tools
|
120
|
-
$ gem install bundler
|
121
|
-
$ bundle install
|
122
|
-
|
123
|
-
# Running style checker
|
124
|
-
bundle exec rake lint
|
125
|
-
|
126
|
-
# Running unit tests
|
127
|
-
bundle exec rake test:unit
|
128
|
-
|
129
|
-
# Running integration tests (requires Vagrant and VirtualBox)
|
130
|
-
bundle exec rake test:integration
|
131
|
-
```
|
132
|
-
|
133
|
-
## Contributing
|
134
|
-
|
135
|
-
1. Fork it
|
136
|
-
1. Create your feature branch (git checkout -b my-new-feature)
|
137
|
-
1. Commit your changes (git commit -sam 'Add some feature')
|
138
|
-
1. Push to the branch (git push origin my-new-feature)
|
139
|
-
1. Create new Pull Request
|
140
|
-
|
141
|
-
## License
|
142
|
-
|
143
|
-
| **Author:** | Paul Welch
|
144
|
-
|
145
|
-
| **Author:** | David McCown
|
146
|
-
|
147
|
-
| **Author:** | Clinton Wolfe
|
148
|
-
|
149
|
-
| **Copyright:** | Copyright (c) 2018-2019 Chef Software Inc.
|
150
|
-
|
151
|
-
| **License:** | Apache License, Version 2.0
|
152
|
-
|
153
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
154
|
-
you may not use this file except in compliance with the License.
|
155
|
-
You may obtain a copy of the License at
|
156
|
-
|
157
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
158
|
-
|
159
|
-
Unless required by applicable law or agreed to in writing, software
|
160
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
161
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
162
|
-
See the License for the specific language governing permissions and
|
163
|
-
limitations under the License.
|