{"action":"created","issue":{"url":"https://api.github.com/repos/emyl/vagrant-triggers/issues/49","labels_url":"https://api.github.com/repos/emyl/vagrant-triggers/issues/49/labels{/name}","comments_url":"https://api.github.com/repos/emyl/vagrant-triggers/issues/49/comments","events_url":"https://api.github.com/repos/emyl/vagrant-triggers/issues/49/events","html_url":"https://github.com/emyl/vagrant-triggers/issues/49","id":87811149,"number":49,"title":"info logging providing two different command outputs for the same command.","user":{"login":"ephantom","id":4064084,"avatar_url":"https://avatars.githubusercontent.com/u/4064084?v=3","gravatar_id":"","url":"https://api.github.com/users/ephantom","html_url":"https://github.com/ephantom","followers_url":"https://api.github.com/users/ephantom/followers","following_url":"https://api.github.com/users/ephantom/following{/other_user}","gists_url":"https://api.github.com/users/ephantom/gists{/gist_id}","starred_url":"https://api.github.com/users/ephantom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ephantom/subscriptions","organizations_url":"https://api.github.com/users/ephantom/orgs","repos_url":"https://api.github.com/users/ephantom/repos","events_url":"https://api.github.com/users/ephantom/events{/privacy}","received_events_url":"https://api.github.com/users/ephantom/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-06-12T18:22:49Z","updated_at":"2015-06-12T19:24:38Z","closed_at":"2015-06-12T19:24:38Z","body":"OS Centos 6\r\nINFO global: Vagrant version: 1.7.2\r\nINFO global: Ruby version: 2.0.0\r\nINFO global: RubyGems version: 2.0.14\r\nINFO global:   - vagrant-triggers = 0.5.0\r\n\r\n\r\nSo I have a  problem with passing quotes within quotes while using vagrant-triggers.\r\n\r\nEssentially I'm trying to run this sed command, which works fine on the command line:\r\nsed -i -r 's/\"groups\": \\[$/\"groups\": \\[\\n    \"TEST_admin\",/' ~/chef-repo/data_bags/users/vagrant.json\r\n\r\nNormally that would be:\r\nrun  \"sed -i -r 's/\"groups\": \\[$/\"groups\": \\[\\n    \"TEST_admin\",/' ~/chef-repo/data_bags/users/vagrant.json\"\r\n\r\nThe quotes being processed on three different levels (vagrant-triggers, command line and regular expression) causes a problem. Using ruby variables I've eliminated one level of the problem now I only have to deal with vagrant-triggers (ruby) and command line. I can theoretically backslash a quote to fix that problem.\r\n\r\n\r\n       #Before we do anything with this box:\r\n       config.trigger.before :up do\r\n        admimquote = '\"TEST_admin\"'\r\n        groupquote = '\"groups\"'\r\n        run  \"sed -i -r \\'s/#{groupquote}: \\\\[$/#{groupquote}: \\\\[\\\\n    #{admimquote},/\\' ~/chef-repo/data_bags/users/vagrant.json\"\r\n       end\r\n   \r\n\r\nThe reason I'm logging this as a possible bug ticket is that I'm getting back two responses from the logging and I can't tell which one its outputted to the command line.\r\n\r\n\"INFO interface:\" indicates its executing this command:\r\nsed -i -r s/\"groups\": [$/\"groups\": [n    \"TEST_admin\",/ ~/chef-repo/data_bags/users/vagrant.json\r\n\r\nThe \"ERROR warden:\" is indicating it received this command:\r\nsed -i -r 's/\"groups\": \\[$/\"groups\": \\[\\n    \"TEST_admin\",/' ~/chef-repo/data_bags/users/vagrant.json\r\n\r\n\r\nI can't tell from the logs which command was actually sent to the command line. \r\n\r\n\r\nHere is the full error:\r\n\r\n     INFO interface: info: Executing command \"sed -i -r s/\"groups\": [$/\"groups\": [n    \"TEST_admin\",/ ~/chef-repo/data_bags/users/vagrant.json\"...\r\n     INFO interface: info: ==> default: Executing command \"sed -i -r s/\"groups\": [$/\"groups\": [n    \"TEST_admin\",/ ~/chef-repo/data_bags/users/vagrant.json\"...\r\n    ==> default: Executing command \"sed -i -r s/\"groups\": [$/\"groups\": [n    \"TEST_admin\",/ ~/chef-repo/data_bags/users/vagrant.json\"...\r\n     INFO subprocess: Starting process: [\"/bin/sed\", \"-i\", \"-r\", \"s/\\\"groups\\\": [$/\\\"groups\\\": [n    \\\"TEST_admin\\\",/\", \"~/chef-repo/data_bags/users/vagrant.json\"]\r\n     INFO interface: error: /bin/sed: -e expression #1, char 47: unterminated `s' command\r\n    \r\n     INFO interface: error: ==> default: /bin/sed: -e expression #1, char 47: unterminated `s' command\r\n    ==> default: /bin/sed: -e expression #1, char 47: unterminated `s' command\r\n     INFO interface: info: Command execution finished.\r\n     INFO interface: info: ==> default: Command execution finished.\r\n    ==> default: Command execution finished.\r\n    ERROR warden: Error occurred: The command \"sed -i -r 's/\"groups\": \\[$/\"groups\": \\[\\n    \"TEST_admin\",/' ~/chef-repo/data_bags/users/vagrant.json\" returned a failed exit code. The\r\n    error output is shown below:\r\n    \r\n    /bin/sed: -e expression #1, char 47: unterminated `s' command\r\n\r\n\r\n\r\nFor testing here’s the pertinent portion of vagrant.json that sed is working on the sed command should add a line between groups and lastentry:\r\n\r\n      \"groups\": [\r\n        \"lastentry\"\r\n      ],\r\n"},"comment":{"url":"https://api.github.com/repos/emyl/vagrant-triggers/issues/comments/111594330","html_url":"https://github.com/emyl/vagrant-triggers/issues/49#issuecomment-111594330","issue_url":"https://api.github.com/repos/emyl/vagrant-triggers/issues/49","id":111594330,"user":{"login":"ephantom","id":4064084,"avatar_url":"https://avatars.githubusercontent.com/u/4064084?v=3","gravatar_id":"","url":"https://api.github.com/users/ephantom","html_url":"https://github.com/ephantom","followers_url":"https://api.github.com/users/ephantom/followers","following_url":"https://api.github.com/users/ephantom/following{/other_user}","gists_url":"https://api.github.com/users/ephantom/gists{/gist_id}","starred_url":"https://api.github.com/users/ephantom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ephantom/subscriptions","organizations_url":"https://api.github.com/users/ephantom/orgs","repos_url":"https://api.github.com/users/ephantom/repos","events_url":"https://api.github.com/users/ephantom/events{/privacy}","received_events_url":"https://api.github.com/users/ephantom/received_events","type":"User","site_admin":false},"created_at":"2015-06-12T19:24:38Z","updated_at":"2015-06-12T19:24:38Z","body":"I just tried the following which should have removed all quoting issues. but it looks like there is still a problem:\r\n\r\n    admimquote = '\"TEST_admin\"'\r\n    groupquote = '\"groups\"'\r\n    runthis = \"sed -i -r 's/\" + groupquote + \": \\[$/\" + groupquote + \": \\[\" + '\\n' + \"    \" + admimquote + \",/' ~/chef-repo/data_bags/users/vagrant.json\"\r\n    run   runthis\r\n    \r\n    ==> default: Executing command \"sed -i -r s/\"groups\": [$/\"groups\": [n    \"TEST_admin\",/ ~/chef-repo/data_bags/users/vagrant.json\"...\r\n    ==> default: /bin/sed: -e expression #1, char 47: unterminated `s' command\r\n    ==> default: Command execution finished.\r\n    The command \"sed -i -r 's/\"groups\": [$/\"groups\": [\\n    \"TEST_admin\",/' ~/chef-repo/data_bags/users/vagrant.json\" returned a failed exit code. The\r\n    error output is shown below:\r\n    \r\n    /bin/sed: -e expression #1, char 47: unterminated `s' command"}}