File tree Expand file tree Collapse file tree 8 files changed +31
-8
lines changed
integration/default/controls Expand file tree Collapse file tree 8 files changed +31
-8
lines changed Original file line number Diff line number Diff line change 6
6
{%- from tplroot ~ " /map.jinja" import node with context % }
7
7
{%- from tplroot ~ " /libtofs.jinja" import files_switch with context % }
8
8
9
- {%- if ' environ' in node and node.environ % }
9
+ {%- if ' environ' in node and node.environ and grains.os_family != ' Windows ' % }
10
10
11
11
{%- if node.pkg.use_upstream_source % }
12
12
{%- set sls_package_install = tplroot ~ ' .source.install' % }
Original file line number Diff line number Diff line change @@ -24,9 +24,11 @@ node-config-npmrc-file-managed-config_file:
24
24
lookup = ' node-config-file-file-managed-config_file'
25
25
)
26
26
}}
27
+ {%- if grains.os_family != ' Windows' % }
27
28
- mode: 640
28
29
- user: {{ node.rootuser }}
29
30
- group: {{ node.rootgroup }}
31
+ {%- endif % }
30
32
- makedirs: True
31
33
- template: jinja
32
34
- context:
Original file line number Diff line number Diff line change 5
5
{%- set tplroot = tpldir.split(' /' )[0 ] %}
6
6
{%- from tplroot ~ " /map.jinja" import node with context % }
7
7
8
- {%- if grains.os_family not in (' Windows ' , ' MacOS' ,) % }
8
+ {%- if grains.os_family not in (' MacOS' ,) % }
9
9
{%- set p = node.pkg % }
10
10
11
11
include:
Original file line number Diff line number Diff line change @@ -84,7 +84,11 @@ OpenBSD:
84
84
Solaris : {}
85
85
86
86
Windows :
87
+ config_file : C:\Program Files\nodejs\node_modules\npm\npmrc
88
+ config :
89
+ prefix : ' ${APPDATA}\\npm'
87
90
pkg :
91
+ name : node.js
88
92
source :
89
93
# win-x64/node.exe
90
94
source_hash : 7fca04f83b0e2169e41b2e1845e8da0f07d66cf9c3a1b4150767bf3ffddccf62
Original file line number Diff line number Diff line change 1
1
# frozen_string_literal: true
2
2
3
3
# Overide by Platform
4
+ npmrc_file , config_prefix =
5
+ case platform [ :family ]
6
+ when 'windows'
7
+ [ 'C:\\Program Files\\nodejs\\node_modules\\npm\\npmrc' , '${APPDATA}\\npm' ]
8
+ else
9
+ %w[ /etc/npmrc /home/vagrant/.npm-packages ]
10
+ end
11
+
4
12
root_group =
5
13
case platform [ :family ]
6
14
when 'bsd'
12
20
control 'node configuration' do
13
21
title 'should match desired lines'
14
22
15
- describe file ( '/etc/npmrc' ) do
23
+ describe file ( npmrc_file ) do
16
24
it { should be_file }
17
- it { should be_owned_by 'root' }
18
- it { should be_grouped_into root_group }
19
- its ( 'mode' ) { should cmp '0640' }
20
- its ( 'content' ) { should include 'prefix = /home/vagrant/.npm-packages' }
25
+ unless %w[ windows ] . include? ( platform [ :family ] )
26
+ it { should be_owned_by 'root' }
27
+ it { should be_grouped_into root_group }
28
+ its ( 'mode' ) { should cmp '0640' }
29
+ end
30
+ its ( 'content' ) { should include "prefix = #{ config_prefix } " }
21
31
end
22
32
end
Original file line number Diff line number Diff line change 12
12
control 'node configuration environment' do
13
13
title 'should match desired lines'
14
14
15
+ only_if ( 'Environment file not managed on Windows' ) do
16
+ !%w[ windows ] . include? ( system . platform [ :name ] )
17
+ end
18
+
15
19
describe file ( '/etc/default/node.sh' ) do
16
20
it { should be_file }
17
21
it { should be_owned_by 'root' }
Original file line number Diff line number Diff line change 20
20
else
21
21
'nodejs'
22
22
end
23
+ when 'windows'
24
+ 'node.js'
23
25
else
24
26
'nodejs'
25
27
end
Original file line number Diff line number Diff line change 4
4
node :
5
5
version : 16.13.0
6
6
config :
7
- prefix : ' /home/vagrant/.npm-packages'
7
+ # yamllint disable-line rule:line-length
8
+ prefix : ' {{ "${APPDATA}\\npm" if grains.os == "Windows" else "/home/vagrant/.npm-packages" }}'
8
9
environ :
9
10
a : b
10
11
pkg :
You can’t perform that action at this time.
0 commit comments