About | FAQ | Help
Ask Your Question

exec error "sh: 1: Syntax error: "(" unexpected"

asked 2018-04-27 14:15:27 -0500

tylerecouture gravatar image

updated 2018-04-27 14:21:54 -0500

I'm trying to install netdata using their kickstart script, with this:

   exec {'netdata-kickstart':
    command => "bash <(curl -Ss https://my-netdata.io/kickstart.sh) all --dont-wait",
    path    => ["/bin/", "/usr/bin/"],
    creates => "/etc/netdata"

But I'm getting this error:

Notice: /Stage[main]/Profile::Utils_netdata/Exec[netdata-kickstart]/returns : sh: 1: Syntax error: "(" unexpected

Error: 'bash <(curl -Ss https://my-netdata.io/kickstart.sh) --dont-wait' returned 2 instead of one of [0]

Error: /Stage[main]/Profile::Utils_netdata/Exec[netdata-kickstart]/returns: change from notrun to 0 failed: 'bash <(curl -Ss https://my-netdata.io/kickstart.sh) --dont-wait' returned 2 instead of one of [0]

The command works if run directly.

edit retag flag offensive close merge delete


I think you can try escaping the parenthesis..

Mr_Sharma gravatar imageMr_Sharma ( 2018-04-27 17:22:47 -0500 )edit

I think you can set `provider => 'posix'` since you're invoking a shell anyway [a shell different than the default `/bin/sh`].

Kai Burghardt gravatar imageKai Burghardt ( 2018-04-28 13:37:43 -0500 )edit

Why you don't use single quote in command directive, use double quote only where you are using variables.

c4f4t0r gravatar imagec4f4t0r ( 2018-04-29 03:35:44 -0500 )edit

@tyler Yeah, I _know_. But maybe somewhere you're setting another default. Unless you know for sure the selected provider _is_ `posix`, I'd try it and give it a go specifying the provider _explicitly_. If it's got no impact, then choosing the provider w/o any reason is considered as bad style. Sure.

Kai Burghardt gravatar imageKai Burghardt ( 2018-04-29 16:48:45 -0500 )edit

1 Answer

Sort by » oldest newest most voted

answered 2018-04-30 06:12:48 -0500

updated 2018-04-30 19:01:31 -0500

binford2k gravatar image

The command that you're trying to run doesn't appear to be correct. You should try out the command on the command line (outside the puppet context) till it works. It's a little confusing how <(…) works: Short answer, <(my_command) virtually becomes the _string_ /proc/123/fd/1 (where 123 is variable).

bash(1) starts interpreting its cmdline expecting the first argument to be a path to an executable file. However, since the first character is a < a _redirection_ is expected. That's what's causing this error message. Process substitution (the <(…) syntax) only works for arguments past the first word.

Isn't there another way to create your /etc/netdata file? Automatically drawing scripts via the Internet is, from a security perspective, not really a good idea. Puppet will execute these scripts with root privileges.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2018-04-27 14:15:27 -0500

Seen: 123 times

Last updated: Apr 30