Home Help Center

Prevent templates parameters quoting

lafayejlafayej Member Julien LafayeOrganization: Capital Fund ManagementProject: Control distributed data acquisition application
I want to use IceGrid to start the same binary on different Ice nodes. The behavior of this binary is controlled by a lengthy list of parameters.

The starting command should be the following:

on server1: /usr/bin/collector -h host1 -i 0 --with-lbt-hack
on server2: /usr/bin/collector -h host2 -i 1 --with-auto-prefix --with-lbt-hack
on server3: /usr/bin/collector -h host3 -i 2

Hence, I've defined a server template with 3 parameters 'host', 'index' and 'extra_options' and the following Command Arguments:
-h ${host} -i ${index} ${extra_options}

My problem is that when instantiate the template with host='host2', index='1' and extra_options='--with-auto-prefix --with-lbt-hack' the following command line is built:
/usr/bin/collector -h host2 -i 1 "--with-auto-prefix --with-lbt-hack"
which is considered as invalid by my application (the extra_options expansion is double-quotted and considered as a single parameter)
(The two other expansions are fine)

My question: how to prevent parameters quoting for parameters containing a space character ? Is there any known workaround for this problem.


Regards,

Julien Lafaye

Attached is an extract from the application xml file.

Comments

  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi,

    Which Ice version and platform do you use? I don't see where IceGrid would be adding quotes here. How did you find that IceGrid was adding quotes?

    In any case, the behavior you're seeing is expected. An option specified with the <option> element is always passed as a single argv argument in the server (even if it contains spaces).

    I'm afraid there are no easy ways to do what you want... with command line arguments at least. Perhaps you should consider using properties instead?

    With properties you could easily change the configuration of specific server instances, for example:
          <node name="host-1">
             <server-instance template="CollectorTemplate" host="host1" index="0"/>
          </node>
          <node name="host-2">
             <server-instance template="CollectorTemplate" host="host2" index="1">
                  <properties>
                      <property name="WithAutoPrefix" value="1"/>
                      <property name="WithLbtHack" value="1"/>
                  </properties>
              </server-instance>
          </node>
    

    Another option would be to specify a template argument for each command line option.

    Cheers,
    Benoit.
  • lafayejlafayej Member Julien LafayeOrganization: Capital Fund ManagementProject: Control distributed data acquisition application
    I have already thought about these two alternatives. In both cases, it requires adding an extra template parameter/Ice property per binary argument. My goal was to avoid this (not mentioning the Ice property solution which also requires patching my binary) since there are many more parameters than the two cited in my example.
    I guess I will have to go for one of these two workarounds since there seems no to be any proper way to do it. :(

    Thank you,

    Julien Lafaye
Sign In or Register to comment.