@@ -26,7 +26,7 @@ export class ConnectionConfiguration implements IConnectionConfiguration {
2626 this . debugFilePath = this . config [ 'languageserver' ] [ 'debugFilePath' ] ;
2727 }
2828
29- get puppetAgentDir ( ) : string {
29+ get puppetBaseDir ( ) : string {
3030 if ( this . config [ 'puppetAgentDir' ] !== null ) {
3131 return this . config [ 'puppetAgentDir' ] ;
3232 }
@@ -37,9 +37,12 @@ export class ConnectionConfiguration implements IConnectionConfiguration {
3737 if ( process . env [ 'PROCESSOR_ARCHITEW6432' ] === 'AMD64' ) {
3838 programFiles = process . env [ 'ProgramW6432' ] || 'C:\\Program Files' ;
3939 }
40+ // On Windows we have a subfolder called 'Puppet' that has
41+ // every product underneath
4042 return path . join ( programFiles , 'Puppet Labs' , 'Puppet' ) ;
4143 default :
42- return '/opt/puppetlabs/puppet' ;
44+ // On *nix we don't have a sub folder called 'Puppet'
45+ return '/opt/puppetlabs' ;
4346 }
4447 }
4548
@@ -61,34 +64,45 @@ export class ConnectionConfiguration implements IConnectionConfiguration {
6164 }
6265
6366 get puppetDir ( ) : string {
64- return path . join ( this . puppetAgentDir , 'puppet' ) ;
67+ return path . join ( this . puppetBaseDir , 'puppet' ) ;
6568 }
6669
6770 get facterDir ( ) : string {
68- return path . join ( this . puppetAgentDir , 'facter' ) ;
71+ return path . join ( this . puppetBaseDir , 'facter' ) ;
6972 }
7073
7174 get hieraDir ( ) : string {
72- return path . join ( this . puppetAgentDir , 'hiera' ) ;
75+ return path . join ( this . puppetBaseDir , 'hiera' ) ;
7376 }
7477
7578 get mcoDir ( ) : string {
76- return path . join ( this . puppetAgentDir , 'mcollective' ) ;
79+ return path . join ( this . puppetBaseDir , 'mcollective' ) ;
7780 }
7881
7982 get rubydir ( ) : string {
80- return path . join ( this . puppetAgentDir , 'sys' , 'ruby' ) ;
83+ switch ( process . platform ) {
84+ case 'win32' :
85+ return path . join ( this . puppetBaseDir , 'sys' , 'ruby' ) ;
86+ default :
87+ return path . join ( this . puppetBaseDir , 'lib' , 'ruby' ) ;
88+ }
89+ }
90+
91+ get sslCertDir ( ) : string {
92+ return path . join ( this . puppetDir , 'ssl' , 'certs' ) ;
8193 }
8294
95+ get sslCertFile ( ) : string {
96+ return path . join ( this . puppetDir , 'ssl' , 'cert.pem' ) ;
97+ }
98+
99+ // RUBYLIB=%PUPPET_DIR%\lib;%FACTERDIR%\lib;%HIERA_DIR%\lib;%RUBYLIB%
83100 get rubylib ( ) : string {
84- var p =
85- path . join ( this . puppetDir , 'lib' ) +
86- this . pathEnvSeparator ( ) +
87- path . join ( this . facterDir , 'lib' ) +
88- this . pathEnvSeparator ( ) +
89- path . join ( this . hieraDir , 'lib' ) +
90- this . pathEnvSeparator ( ) +
91- path . join ( this . mcoDir , 'lib' ) ;
101+ var p = new Array (
102+ path . join ( this . puppetDir , 'lib' ) ,
103+ path . join ( this . facterDir , 'lib' ) ,
104+ // path.join(this.hieraDir, 'lib'),
105+ ) . join ( this . pathEnvSeparator ( ) ) ;
92106
93107 if ( process . platform === 'win32' ) {
94108 // Translate all slashes to / style to avoid puppet/ruby issue #11930
@@ -98,31 +112,16 @@ export class ConnectionConfiguration implements IConnectionConfiguration {
98112 return p ;
99113 }
100114
101- get sslCertDir ( ) : string {
102- return path . join ( this . puppetDir , 'ssl' , 'certs' ) ;
103- }
104-
105- get sslCertFile ( ) : string {
106- return path . join ( this . puppetDir , 'ssl' , 'cert.pem' ) ;
107- }
108-
115+ // PATH=%PUPPET_DIR%\bin;%FACTERDIR%\bin;%HIERA_DIR%\bin;%PL_BASEDIR%\bin;%RUBY_DIR%\bin;%PL_BASEDIR%\sys\tools\bin;%PATH%
109116 get environmentPath ( ) : string {
110- return (
111- path . join ( this . puppetDir , 'bin' ) +
112- this . pathEnvSeparator ( ) +
113- path . join ( this . facterDir , 'bin' ) +
114- this . pathEnvSeparator ( ) +
115- path . join ( this . hieraDir , 'bin' ) +
116- this . pathEnvSeparator ( ) +
117- path . join ( this . mcoDir , 'bin' ) +
118- this . pathEnvSeparator ( ) +
119- path . join ( this . puppetAgentDir , 'bin' ) +
120- this . pathEnvSeparator ( ) +
121- path . join ( this . rubydir , 'bin' ) +
122- this . pathEnvSeparator ( ) +
123- path . join ( this . puppetAgentDir , 'sys' , 'tools' , 'bin' ) +
124- this . pathEnvSeparator ( )
125- ) ;
117+ return new Array (
118+ path . join ( this . puppetDir , 'bin' ) ,
119+ path . join ( this . facterDir , 'bin' ) ,
120+ // path.join(this.hieraDir, 'bin'),
121+ path . join ( this . puppetBaseDir , 'bin' ) ,
122+ path . join ( this . rubydir , 'bin' ) ,
123+ path . join ( this . puppetBaseDir , 'sys' , 'tools' , 'bin' )
124+ ) . join ( this . pathEnvSeparator ( ) ) ;
126125 }
127126
128127 get languageServerPath ( ) : string {
0 commit comments