train-pgsql 1.2.2 → 2.0.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bf9046c760c47e717c33a05f1044d3142036509cc0fa883ab7ddc6b9664dc8e0
4
- data.tar.gz: 901fc8f8862e6eb8ae21d9c8340927653d875d476d55db2accbdff90688a4b5e
3
+ metadata.gz: 6cc43010edf32c388d28ccc471efab2426f34929ee85ab8740aa8ea1c966c8fe
4
+ data.tar.gz: baa255ee6e272fb9c5adefcffe319b4bf3f5379866b9944e432302a8638d9151
5
5
  SHA512:
6
- metadata.gz: b34564dc3c47a2be228d7ee67e833d490e533b683775aaac3050dbc17d490509f5935046ecef1b71bef4dcb2af1a5dd0120aa74fd897040fb554889a1135756f
7
- data.tar.gz: bba454681a04de826b47e109927189a030b9718d17b2c4351b2e293ae73679e594dd746a3e3e22794f238fc757b064dba53c060d7c1d3b81157d65a42749273b
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
- result.each_row do |values|
40
- stdout += values.join(', ') + "\n"
41
- end
42
- stdout = stdout.strip
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
@@ -1,5 +1,5 @@
1
1
  module TrainPlugins
2
2
  module Pgsql
3
- VERSION = '1.2.2'.freeze
3
+ VERSION = '2.0.0'.freeze
4
4
  end
5
5
  end
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: 1.2.2
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-27 00:00:00.000000000 Z
11
+ date: 2020-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: train