You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sync-up changes
- Update default log location
- Add syslog support
- Add a python library to invoke plugin manager
- Add '-plugins' option to specify plugins info as a json string or in a file in json/yaml format.
- Add option for specifying Log Level; Generate log file inside specified dir.
-[Example: Writing plugins result to a `output-file` in `output-format` {json, yaml} format](#example-writing-plugins-result-to-a-output-file-in-output-format-json-yaml-format)
@@ -87,6 +90,7 @@ The PM list command syntax / usage is as shown below:
87
90
```bash
88
91
pm list -type <PluginType>
89
92
[-library=<PluginsLibraryPath>]
93
+
[-log-tag=<TagOfSysLog>]
90
94
[-log-dir=<LogDirectory>]
91
95
[-log-file=<NameOfLogFile>]
92
96
```
@@ -96,6 +100,9 @@ where
96
100
-**`type`**: Indicates the plugin type.
97
101
-**`library`**: Indicates the location of plugins library.
98
102
**Overrides** value present in PM configuration.
103
+
-**`log-tag`**: Indicates the log tag written by rsyslog.
104
+
Note: rsyslog is used as default logger for both main and plugin logs.
105
+
It will be overwritten if `log-file` option set.
99
106
-**`log-dir`**: Indicates the log directory path.
100
107
**Overrides** value present in PM configuration.
101
108
-**`log-file`**: Indicates the name of the log file.
@@ -113,7 +120,7 @@ The list of plugins are mapped in .//preupgrade.2020-01-13T15:56:46.725348-08:00
113
120
114
121
Plugin Manager can be configured to look for plugins at a specific location,
115
122
and to write logs to a specific file by specifying those details in the
Instead of updating the default config file, one can choose to provide his/her
119
126
own custom config file.
@@ -138,7 +145,7 @@ PluginManager:
138
145
# The timestamp and '.log' extension would be appended to this name.
139
146
# I.e., The format of the log file generated would be: "<log file>.<timestamp>.log"
140
147
# Example: The below value results in following log file: pm.2020-01-13T16:11:58.6006565-08:00.log
141
-
log file: "pm"
148
+
log file: "pm.log"
142
149
...
143
150
```
144
151
@@ -156,9 +163,11 @@ exit value of plugins, the PM exits with 1.
156
163
The PM run command syntax / usage is as shown below:
157
164
158
165
```bash
159
-
pm run -type <PluginType>
166
+
pm run [-plugins <PluginInformation>]
167
+
[-type <PluginType>]
160
168
[-library=<PluginsLibraryPath>]
161
169
[-sequential[={true|1|false|0}]]
170
+
[-log-tag=<TagOfSysLog>]
162
171
[-log-dir=<LogDirectory>]
163
172
[-log-file=<NameOfLogFile>]
164
173
[-output={json|yaml}]
@@ -167,13 +176,16 @@ pm run -type <PluginType>
167
176
168
177
where
169
178
179
+
- **`plugins`**: A json string or a json file containing plugins and its dependencies.
170
180
- **`type`**: Indicates the plugin type.
171
181
- **`library`**: Indicates the location of plugins library.
172
182
**Overrides** value present in PM configuration.
183
+
**NOTE** The specified value gets set as an environment variable `PM_LIBRARY`forthe plugins being run. The plugin file can access any scriptsin the same folder via `PM_LIBRARY` variable.
173
184
- **`-sequential`**: Indicates PM to execute only one plugin at a time
174
185
regardless of how many plugins' dependencies are met.
175
186
**Default: Disabled**. To enable, specify `-sequential=true` or just
176
187
`-sequential` while running PM.
188
+
- **`log-tag`**: Indicates the log tag written by rsyslog. The `log-tag` option will supercede `log-dir` and `log-file` options.
177
189
- **`log-dir`**: Indicates the log directory path.
178
190
**Overrides** value present in PM configuration.
179
191
- **`log-file`**: Indicates the name of the log file.
@@ -185,7 +197,86 @@ where
185
197
If `output` format is specified, and `output-file` is not specified,
186
198
then result will be displayed on console.
187
199
188
-
### Example: Plugin Manager (PM) `run`
200
+
### Example: Plugin Manager (PM) `run -plugins`
201
+
202
+
```json
203
+
$ jq -n "$plugins" | tee sample/plugins-prereboot.json
204
+
{
205
+
"Plugins": [
206
+
{
207
+
"Name": "A/a.prereboot",
208
+
"Description": "Applying \"A\" settings",
209
+
"ExecStart": "/usr/bin/ls -l -t",
210
+
"Requires": [
211
+
"C/c.prereboot",
212
+
"D/d.prereboot"
213
+
]
214
+
},
215
+
{
216
+
"Name": "B/b.prereboot",
217
+
"Description": "Applying \"B\" settings...",
218
+
"ExecStart": "/bin/echo \"Running B...\"",
219
+
"RequiredBy": [
220
+
"D/d.prereboot"
221
+
]
222
+
},
223
+
{
224
+
"Name": "C/c.prereboot",
225
+
"Description": "Applying \"C\" settings...",
226
+
"ExecStart": "/bin/echo \"Running C...\"",
227
+
"RequiredBy": [
228
+
"A/a.prereboot"
229
+
]
230
+
},
231
+
{
232
+
"Name": "D/d.prereboot",
233
+
"Description": "Applying \"D\" settings...",
234
+
"ExecStart": "/bin/echo 'Running D...!'",
235
+
"RequiredBy": [
236
+
"A/a.prereboot"
237
+
],
238
+
"Requires": [
239
+
"B/b.prereboot"
240
+
]
241
+
}
242
+
]
243
+
}
244
+
$
245
+
```
246
+
247
+
#### Specify `-plugins` details as a json string
248
+
249
+
```bash
250
+
$ $GOBIN/pm run -plugins "$plugins"
251
+
Applying "B" settings...: Starting
252
+
Applying "C" settings...: Starting
253
+
Applying "B" settings...: Succeeded
254
+
Applying "D" settings...: Starting
255
+
Applying "C" settings...: Succeeded
256
+
Applying "D" settings...: Succeeded
257
+
Applying "A" settings: Starting
258
+
Applying "A" settings: Succeeded
259
+
Running plugins: Succeeded
260
+
bash-5.1$
261
+
```
262
+
263
+
#### Specify `-plugins` details via json file
264
+
265
+
```bash
266
+
$ $GOBIN/pm run -plugins "./sample/plugins-prereboot.json" -library sample/library/
267
+
Applying "C" settings...: Starting
268
+
Applying "B" settings...: Starting
269
+
Applying "C" settings...: Succeeded
270
+
Applying "B" settings...: Succeeded
271
+
Applying "D" settings...: Starting
272
+
Applying "D" settings...: Succeeded
273
+
Applying "A" settings: Starting
274
+
Applying "A" settings: Succeeded
275
+
Running plugins: Succeeded
276
+
$
277
+
```
278
+
279
+
### Example: Plugin Manager (PM) `run -type`
189
280
190
281
```bash
191
282
$ $GOBIN/pm run -type=prereboot
@@ -253,7 +344,7 @@ $
253
344
254
345
```bash
255
346
$ $GOBIN/pm run -type preupgrade -output-format=json -output-file=a.json -library ./sample/library/
0 commit comments