train-pwsh 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e116dd35ef28fabbaacb70352c42a8335d028949f7cd417418b2bce4b9bdd008
4
- data.tar.gz: 23fe2e4625a8a8904899de5dada14a625e6e1aa1ee0ae627aa44a263e770ff2c
3
+ metadata.gz: dee3811f1e76e743dad03b5fbda0ef38f5ce9f0d0503a2634d109674a4f80c1e
4
+ data.tar.gz: f3e63fb43c571e462a9a253968daece5d18d8083c21280c3749104a521407d8b
5
5
  SHA512:
6
- metadata.gz: 1d44661cc9311e5f20cdedc53ef30706758945d3b96e7e5ca4814d0127a1c73cc340897de239f583a60a06108536acf59e328e801d6bc1fb09fa491c2bc7b045
7
- data.tar.gz: 6f8dc2b638115c43d20a967a653081ecd4927910f3d5dceac8d9836137c060fa73950b86c90fab478113f667a1220132144c80aaf6fa74db7883a9c104490428
6
+ metadata.gz: b4a6938760a23e90e50904f7953d39d2706ba7b4b5f6db48f91a1308dea5ce8391c50def5aeed255e9d3eac9eacc28c4b975fc019e187389ac616a302a805486
7
+ data.tar.gz: 33914e811691e4b1f284b2e33d49515808e0a19925795935485484278f9df90e0607bee8898efcdc1a81d185183325f3b495b395892a72c84da8f121cd28769c
data/README.md CHANGED
@@ -11,7 +11,13 @@ A train-pwsh connection has 7 fields that are needed for authentication, which a
11
11
 
12
12
  These fields need to be defined in the config file stored at this directory: `~/.inspec/config.json`. Particularly, under the `credentials` key of the json file, create a `pwsh` key with the value being another dictionary. This dictionary should have a key named `pwsh-options` with the value being another dictionary. This dictionary should contain the names of the seven fields above as well as their values. Please refer to this [link](https://origin.inspec.io/docs/reference/config/) for more detailed instructions.
13
13
 
14
- Alternatively, if train is being invoked using code, this is how it can be used:
14
+ On top of this, environment variables may need to be defined for some of these seven fields if they are to be used elsewhere in the profile as inputs. The README for the profile will specify which ones need to be stored as environment variables.
15
+
16
+ To set an environment variable on Mac, go to the `zschrc` file located at `~/.zschrc` and enter in the following syntax: `export VARIABLE_NAME='insert_value'`
17
+
18
+ To se and environment variable on Windows, click `Win + R`, type `cmd`, and hit enter. Then, this syntax can be used `setx VARIABLE_NAME "Variable Value"`
19
+
20
+ If train is being invoked using code, this is how it can be used:
15
21
 
16
22
  **Pwsh**
17
23
 
@@ -106,6 +106,7 @@ module TrainPlugins
106
106
  If($null -eq (get-module -name "ExchangeOnlineManagement")){import-module ExchangeOnlineManagement}
107
107
  $password = ConvertTo-SecureString -String $clientSecret -AsPlainText -Force
108
108
  $ClientSecretCredential = New-Object -TypeName System.Management.Automation.PSCredential($client_id,$password)
109
+ Connect-IPPSSession -AppID $client_id -CertificateFilePath $certificate_path -CertificatePassword (ConvertTo-SecureString -String $certificate_password -AsPlainText -Force) -Organization $organization -ShowBanner:$false
109
110
  Connect-ExchangeOnline -CertificateFilePath $certificate_path -CertificatePassword (ConvertTo-SecureString -String $certificate_password -AsPlainText -Force) -AppID $client_id -Organization $organization -ShowBanner:$false
110
111
  }
111
112
 
@@ -144,11 +145,17 @@ module TrainPlugins
144
145
 
145
146
  def run_script_in_graph_exchange(script)
146
147
  result = @pwsh_session_graph_exchange.execute(script)
148
+ if result[:stdout].nil?
149
+ result[:stdout] = ""
150
+ end
147
151
  return CommandResult.new(result[:stdout],result[:stderr],result[:exitcode])
148
152
  end
149
153
 
150
154
  def run_script_in_teams_pnp(script)
151
155
  result = @pwsh_session_teams_pnp.execute(script)
156
+ if result[:stdout].nil?
157
+ result[:stdout] = ""
158
+ end
152
159
  return CommandResult.new(result[:stdout],result[:stderr],result[:exitcode])
153
160
  end
154
161
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Train
4
4
  module Pwsh
5
- VERSION = "0.1.0"
5
+ VERSION = "0.1.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: train-pwsh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sujay Kandwal
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-12-20 00:00:00.000000000 Z
11
+ date: 2024-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: train