Puppet: Error while trying to execute shell commands in Exec resource type

0 votes

 I get this error when my manifest file runs:

Error: Could not find command 'for'
Error: /Stage[main]/Make_it::App_mp3files/Exec[Normalize MP3 filename]/returns: change from notrun to 0 failed: Could not find command 'for'

Here's my Exec resource type declaration:

 exec { 'Normalize MP3 filename':
            environment => ["t=0"],
            command => 'for i in *mp3; do  mv -v $i track_`seq -f "%03g" $t $t`.mp3 ; t=`expr $t + 1`; done',
            cwd     => "$resource_path/res/raw",
    } ->

Aug 2 in Puppet by Chang
22 views

1 answer to this question.

0 votes

The default exec provider on *nix OSes is posix, which does not support shell built-ins

You should change the provider to shell to use shell built-ins.

exec { 'Normalize MP3 filename':
        environment => ["t=0"],
        command => 'for i in *mp3; do  mv -v $i track_`seq -f "%03g" $t $t`.mp3 ; t=`expr $t + 1`; done',
        cwd     => "$resource_path/res/raw",
        provider => 'shell',
} ->
answered Aug 2 by Sirajul
• 19,670 points

Related Questions In Puppet

0 votes
1 answer

Error while trying to instal mssql tools using puppet

When you use puppet, you don't use ...READ MORE

answered Feb 25 in Puppet by Nandita
79 views
0 votes
1 answer

Puppet: Error when trying to use many manifests

Your kp::testfile is a defined type, not ...READ MORE

answered Aug 7 in Puppet by Sirajul
• 19,670 points
17 views
0 votes
1 answer

Puppet in Docker: Error while running the Puppet container

Try to uncomment the following lines in the definition ...READ MORE

answered 6 days ago in Puppet by Sirajul
• 19,670 points
10 views
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
124 views
0 votes
1 answer
0 votes
1 answer