deployer icon indicating copy to clipboard operation
deployer copied to clipboard

Unable to run commands including {{ }}

Open derfred opened this issue 3 years ago • 5 comments

  • Deployer version: 6.8.0
  • Deployment OS: MacOS to Ubuntu

Running a command that includes {{ }}:

task('cleanup', function () {
    $containers = run('docker ps --format "{{.Names}}"');
});

it gives this error: Configuration parameter '.Names' does not exist.

Can I escape the command parameters?

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar

derfred avatar Jun 13 '22 06:06 derfred

Use a tmp var.

antonmedv avatar Jun 13 '22 07:06 antonmedv

Could you expand on that? I tried this:

task('cleanup', function () {
    set(".Names", "{{.Names}}");
    $containers = run('docker ps --format "{{.Names}}"');
});

but that causes a segmentation fault

derfred avatar Jun 13 '22 08:06 derfred

$var = “{{}}”

antonmedv avatar Jun 13 '22 12:06 antonmedv

How does that escape run() templating?

Bilge avatar Sep 11 '23 23:09 Bilge

I see. Now Ive got the problem. Let's add a proper escaping to deployer.

antonmedv avatar Sep 12 '23 14:09 antonmedv