Skip to content
This repository has been archived by the owner on Feb 17, 2023. It is now read-only.

Issue with single quote (') params with dcapis #446

Open
keyurkapasi opened this issue Aug 21, 2014 · 2 comments
Open

Issue with single quote (') params with dcapis #446

keyurkapasi opened this issue Aug 21, 2014 · 2 comments

Comments

@keyurkapasi
Copy link

Facing issue with parameters having single quote using dcapi codes. It ignore single quote (') and generate runfile without the quote. following is my dcapi code

export CHECKOUT=/root/design-center/tools/cf-sketch
export DCJV=$CHECKOUT/config-vagrant.json
export CFAPI=$CHECKOUT/cf-dc-api.pl

echo '{ dc_api_version: "3.6.0", request: {define: { "vagrant::System::sysconfig::sysconfig_deb": { "System::sysconfig": { "profile_params" :[ "source /etc/bash.bashrc" ], "bashrc_params_deb" : ["export LS_OPTIONS='--color=auto'", "alias ls='ls $LS_OPTIONS'", "alias ll='ls $LS_OPTIONS -l'", "alias l='ls $LS_OPTIONS -lA'"], "locale_gen" : "en_US.UTF-8 UTF-8", "locale_LANG" : "en_US.UTF-8", "locale_LANGUAGE" : "en_US:en","keyboard_layout_debian" : "de" } } } } }' | $CFAPI $DCJV

The generated runfile and provides the params excluding (') like mentioned

"___001_System_sysconfig_sysconfig_deb_bashrc_params_deb" data => parsejson('["export LS_OPTIONS=--color=auto","alias ls=ls --color=auto","alias ll=ls --color=auto -l","alias l=ls --color=auto -lA"]');

I tried /, \ and many more options but it ignores (') however It works fine with interactive mode. while using interactive mode, it generates runfile using \ like

"__System_sysconfig_1_001_System_sysconfig_sysconfig_deb_bashrc_params_deb" data => parsejson('["export LS_OPTIONS='--color=auto'","alias ls='ls $LS_OPTIONS'"," alias ll='ls $LS_OPTIONS -l'","alias l='ls $LS_OPTIONS -lA'"]);

Anybody has any clue regarding ?

@tzz
Copy link
Contributor

tzz commented Jun 29, 2015

Hi, and sorry for the very late reply (it's due to circumstances beyond my control). I followed your instructions but DC doesn't have a System::sysconfig sketch, so I used System::sysctl with a single quote in the parameters.

So from this JSON:

{
    "System::sysctl":
    {
        "ensured_kv" : { "'net.ipv4.tcp_tw_reuse": 1 },
        "removed_kv" : { "net.ipv4.tcp_tw_reuse": 2 },
        "removed_vars" : [ "bad.entry" ],
        "empty_first" : false
    }
}

I got this in the runfile:

      # array 'ensured_kv' from definition parameter definition from /home/tzz/source/cfengine/design-center/tools/test/../../sketches/system/sysctl/params/example.json, activation ___001_System_sysctl_set
      "___001_System_sysctl_set_ensured_kv" data => parsejson('{"\'net.ipv4.tcp_tw_reuse":1}');

which parses all right. Can you check if this is still a problem with the latest 3.7 beta or from a DC checkout?

@shreyu82
Copy link

Ok thanks, very help full

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

3 participants