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, 2019 in Puppet by Chang
3,082 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, 2019 by Sirajul
• 59,230 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, 2019 in Puppet by Nandita
1,698 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, 2019 in Puppet by Sirajul
• 59,230 points
750 views
+15 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 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
3,942 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP