train-rest 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +32 -0
- data/lib/train-rest/connection.rb +18 -2
- data/lib/train-rest/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b0cc26cff4431701e6fba113884d8c06a943c16cb231e8a564c464e7ba01cf2
|
4
|
+
data.tar.gz: 78aa236a0c1b8a92480b096e9a40b9c3993be5dbafef907a01144cf630e4267f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb7767fe6dbc98466d9f8450a75f6849d21a8876f8672177db891a91edcdf07a075ab6f59ae98ae24759f827b87ce13ecaaa63934d94d44a8e469716c3e04116
|
7
|
+
data.tar.gz: 5f76c1a724b6b2c453f30240d71cd5717c818b722c0df527664980f94a32802492cfa267bab70bf105a37370e70dd61f0f28783980a2f584f7e9e9797298dce6
|
data/README.md
CHANGED
@@ -140,3 +140,35 @@ conn = train.connection
|
|
140
140
|
# Handles logout as well
|
141
141
|
conn.close
|
142
142
|
```
|
143
|
+
|
144
|
+
## Use with Redfish, Your Custom Resources and Chef Target Mode
|
145
|
+
|
146
|
+
1. Set up a credentials file under `~/.chef/credentials` or `/etc/chef/credentials`:
|
147
|
+
|
148
|
+
```toml
|
149
|
+
['10.0.0.1']
|
150
|
+
endpoint = 'https://10.0.0.1/redfish/v1/'
|
151
|
+
username = 'user'
|
152
|
+
password = 'pass'
|
153
|
+
verify_ssl = false
|
154
|
+
auth_type = 'redfish'
|
155
|
+
```
|
156
|
+
|
157
|
+
1. Configure Chef to use the REST transport in `client.rb`:
|
158
|
+
|
159
|
+
```toml
|
160
|
+
target_mode.protocol = "rest"
|
161
|
+
```
|
162
|
+
|
163
|
+
1. Write your custom resources for REST APIs
|
164
|
+
1. Mark them up using the REST methods for target mode:
|
165
|
+
|
166
|
+
```ruby
|
167
|
+
provides :rest_resource, target_mode: true, platform: 'rest'
|
168
|
+
```
|
169
|
+
|
170
|
+
1. Run against the defiend targets via Chef Target Mode:
|
171
|
+
|
172
|
+
```shell
|
173
|
+
chef-client --local-mode --target 10.0.0.1 --runlist 'recipe[my-cookbook:setup]'
|
174
|
+
```
|
@@ -30,8 +30,24 @@ module TrainPlugins
|
|
30
30
|
components.to_s
|
31
31
|
end
|
32
32
|
|
33
|
+
def inventory
|
34
|
+
# Faking it for Chef Target Mode only
|
35
|
+
OpenStruct.new({
|
36
|
+
name: "rest",
|
37
|
+
release: TrainPlugins::Rest::VERSION,
|
38
|
+
family_hierarchy: ["", "api"],
|
39
|
+
family: "api",
|
40
|
+
platform: "rest",
|
41
|
+
platform_version: 0,
|
42
|
+
})
|
43
|
+
end
|
44
|
+
|
45
|
+
alias os inventory
|
46
|
+
|
33
47
|
def platform
|
34
|
-
|
48
|
+
Train::Platforms.name("rest").in_family("api")
|
49
|
+
|
50
|
+
force_platform!("rest", { release: TrainPlugins::Rest::VERSION })
|
35
51
|
end
|
36
52
|
|
37
53
|
# User-faced API
|
@@ -100,7 +116,7 @@ module TrainPlugins
|
|
100
116
|
end
|
101
117
|
|
102
118
|
def auth_type
|
103
|
-
return options[:auth_type] if options[:auth_type]
|
119
|
+
return options[:auth_type].to_sym if options[:auth_type]
|
104
120
|
|
105
121
|
:basic if options[:username] && options[:password]
|
106
122
|
end
|
data/lib/train-rest/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: train-rest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Heinen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
11
|
+
date: 2020-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: train
|