train-pgsql 1.2.2 → 2.0.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 +8 -0
- data/lib/train-pgsql/connection.rb +5 -4
- data/lib/train-pgsql/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: 6cc43010edf32c388d28ccc471efab2426f34929ee85ab8740aa8ea1c966c8fe
|
4
|
+
data.tar.gz: baa255ee6e272fb9c5adefcffe319b4bf3f5379866b9944e432302a8638d9151
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1dfb0415d0c437914a18021c87456687887b38e2f51013610599b5fb2a28683a181291fe08664299ca2e900b03920eb5b5c48365919d274661783d30a77e0297
|
7
|
+
data.tar.gz: 4d8b58bfeea0f915a1a2aea0ffcc3d306972abcab389bc894f2cf6c4a8df7aed11eb616a8af5b746661a125c84499f85a28467948d3593a5f132bd515353856d
|
data/README.md
CHANGED
@@ -27,6 +27,14 @@ inspec plugin install train-pgsql
|
|
27
27
|
| `database` | Database to connect | `postgres` | `PGDATABASE` |
|
28
28
|
| `port` | Remote port | `5432` | `PGPORT` |
|
29
29
|
|
30
|
+
## Transport CommandResult
|
31
|
+
`connection.run_command('SQL HERE')` returns a CommandResult object. The `stdout` value is set to a hash with `fields` and `values`.
|
32
|
+
|
33
|
+
For Example:
|
34
|
+
```
|
35
|
+
#<struct Train::Extras::CommandResult stdout={"fields"=>["name", "owner", "acl"], "values"=>[["public", "postgres", "postgres=UC/postgres"], ["public", "postgres", "=UC/postgres"]]}, stderr="", exit_status=0>
|
36
|
+
```
|
37
|
+
|
30
38
|
|
31
39
|
## Example use in inspec
|
32
40
|
Connect to the postgresql target as such:
|
@@ -36,10 +36,11 @@ module TrainPlugins
|
|
36
36
|
logger.debug format('[Pgsql] Sending command (%s) to %s:%d', query, @options[:host], @options[:port])
|
37
37
|
begin
|
38
38
|
connection.exec(query) do |result|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
39
|
+
stdout = {
|
40
|
+
'fields' => result.fields,
|
41
|
+
'values' => result.values
|
42
|
+
}
|
43
|
+
# stdout = result.values
|
43
44
|
end
|
44
45
|
rescue PG::Error => e
|
45
46
|
stderr = e.message
|
data/lib/train-pgsql/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: train-pgsql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cris Barbero
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-10-
|
11
|
+
date: 2020-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: train
|