Skip to content

Commit e846013

Browse files
authored
Merge pull request #673 from jpogran/gh-670-guard-install-settings
(GH-670) Guard installType and installDirectory
2 parents 12de07f + 2429268 commit e846013

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -472,17 +472,21 @@
472472
},
473473
"puppet.installDirectory": {
474474
"type": "string",
475-
"default": null,
476-
"description": "The fully qualified path to the Puppet install directory. This can be a PDK or Puppet Agent installation. For example: 'C:\\Program Files\\Puppet Labs\\Puppet' or '/opt/puppetlabs/puppet'. If this is not set the extension will attempt to detect the installation directory"
475+
"markdownDescription": "The fully qualified path to the Puppet install directory. This can be a PDK or Puppet Agent installation. For example: 'C:\\Program Files\\Puppet Labs\\Puppet' or '/opt/puppetlabs/puppet'. If this is not set the extension will attempt to detect the installation directory. Do **not** use when `#puppet.installType#` is set to `auto`"
477476
},
478477
"puppet.installType": {
479478
"type": "string",
480479
"default": "auto",
481-
"description": "The type of Puppet installation. Either the Puppet Development Kit (pdk) or the Puppet Agent (agent). Choose 'auto' to have the extension detect which to use automatically based on default install locations",
480+
"markdownDescription": "The type of Puppet installation. Either the Puppet Development Kit (pdk) or the Puppet Agent (agent). Choose `auto` to have the extension detect which to use automatically based on default install locations",
482481
"enum": [
483482
"auto",
484483
"pdk",
485484
"agent"
485+
],
486+
"enumDescriptions": [
487+
"The exention will use the PDK or the Puppet Agent based on default install locations. When both are present, it will use the PDK",
488+
"Use the PDK as an installation source",
489+
"Use the Puppet Agent as an installation source"
486490
]
487491
},
488492
"puppet.notification.nodeGraph": {

src/settings.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,22 @@ export function SettingsFromWorkspace(): ISettings {
170170
pdk: workspaceConfig.get<IPDKSettings>('pdk', defaults.pdk),
171171
};
172172

173+
if (settings.installDirectory && settings.installType === PuppetInstallType.AUTO) {
174+
const message =
175+
"Do not use 'installDirectory' and set 'installType' to auto. The 'installDirectory' setting" +
176+
' is meant for custom installation directories that will not be discovered by the extension';
177+
const title = 'Configuration Information';
178+
const helpLink = 'https://puppet-vscode.github.io/docs/extension-settings';
179+
vscode.window.showErrorMessage(message, { modal: false }, { title: title }).then((item) => {
180+
if (item === undefined) {
181+
return;
182+
}
183+
if (item.title === title) {
184+
vscode.commands.executeCommand('vscode.open', vscode.Uri.parse(helpLink));
185+
}
186+
});
187+
}
188+
173189
/**
174190
* Legacy Workspace Settings
175191
*

0 commit comments

Comments
 (0)