Skip to content

Commit c9521a4

Browse files
Merge pull request #3082 from craigcomstock/ent-13530/master
Fixed cfruncommand for Windows causing "Too many arguments" error
2 parents 7c23670 + d9238b2 commit c9521a4

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

controls/cf_serverd.cf

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,18 @@ body server control
6868

6969
allowusers => { @(def.control_server_allowusers) };
7070

71+
# In 3.10 the quotation is properly closed when EOF is reached. It is left
72+
# open so that arguments (like -K and --remote-bundles) can be appended.
73+
# 3.10.x does not automatically append -I -Dcfruncommand
74+
7175
windows::
72-
cfruncommand => "$(sys.cf_agent) -I -D cf_runagent_initiated -f \"$(sys.update_policy_path)\" &
73-
$(sys.cf_agent) -I -D cf_runagent_initiated";
7476

75-
!windows::
77+
# /s removes the first and last quote characters and aids in specifying paths with surrounding quotes
78+
cfruncommand => "$(def.cf_runagent_shell) /s /c \"
79+
$(sys.cf_agent) -I -D cf_runagent_initiated -f $(sys.update_policy_path) &
80+
$(sys.cf_agent) -I -D cf_runagent_initiated";
7681

77-
# In 3.10 the quotation is properly closed when EOF is reached. It is left
78-
# open so that arguments (like -K and --remote-bundles) can be appended.
79-
# 3.10.x does not automatically append -I -Dcfruncommand
82+
!windows::
8083

8184
cfruncommand => "$(def.cf_runagent_shell) -c \'
8285
$(sys.cf_agent) -I -D cf_runagent_initiated -f $(sys.update_policy_path) ;
@@ -177,7 +180,7 @@ bundle server mpf_default_access_rules()
177180
shortcut => "hub_cmdb",
178181
admit_keys => { $(connection.key) };
179182

180-
!windows::
183+
any::
181184
"$(def.cf_runagent_shell)" -> { "ENT-6673" }
182185
handle => "server_access_grant_access_shell_cmd",
183186
comment => "Grant access to shell for cfruncommand",

controls/def.cf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,12 @@ bundle common def
558558
comment => "Define path to shell used by cf-runagent",
559559
handle => "common_def_vars_solaris_cf_runagent_shell";
560560

561+
windows::
562+
"cf_runagent_shell"
563+
string => "${sys.winsysdir}${const.dirsep}cmd.exe",
564+
comment => "Define path to shell used by cf-runagent",
565+
handle => "common_def_vars_windows_cf_runagent_shell";
566+
561567
!(windows|solaris)::
562568
"cf_runagent_shell"
563569
string => "/bin/sh",

0 commit comments

Comments
 (0)