2017-12-11 3 views
0

puppet apply에 인수 인수를 전달하려고합니다.인형에 인수를 전달하지 못하는 사실이 적용됩니다.

export FACTER_command="start" 
puppet apply site.pp $FACTER_command 

내 코드에서 내가 가진 : 여기에 내가 시도 무엇

Error: '/bin/bash -c "/some/path/to/scripts.sh -t some_arg $::command"' returned 1 instead of one of [0] 
Error: /Stage[main]/Standard/Exec[some_exec]/returns: change from 'notrun' to ['0'] failed: '/some/path/to/scripts.sh -t some_arg $::command"' returned 1 instead of one of [0] 

사람이 어떤이 있습니까 :

exec { 'some_exec': 
    command => '/bin/bash -c "/some/path/to/scripts.sh -t some_arg $::command"', 

은 ...

나는이 메시지 오류가 이것에 대한 생각?

UPDATE

class standard{ 

     $param_test="/some/path/to/scripts.sh -t some_arg ${::command}" 
     file{'kick_servers': 
       ensure => 'file', 
       path => '/some/path/to/scripts.sh', 
       owner => 'some_user, 
       group => 'some_user', 
       mode => '0755', 
       notify => Exec['some_exec'] 
     } 

     exec { 'some_exec': 
       command => '/bin/bash -c ${param_test}', 
       cwd => "$home_user_dir", 
       timeout  => 1800 
     } 
} 

node default { 
    include standard 
} 

그리고이 오류를 얻을

Error: '/bin/bash -c $param_test' returned 2 instead of one of [0] 
Error: /Stage[main]/Standard/Exec[some_exec]/returns: change from 'notrun' to ['0'] failed: '/bin/bash -c $param_test' returned 2 instead of one of [0] 

답변

2

예. 당신은 당신이 거기 수정해야 적어도 두 가지 문제가 있습니다

1/

문제의 직접적인 원인은 당신이 때 실제로 당신이 리터럴 문자열 $::command을 의미 꼭두각시, 이야기, 작은 따옴표 안에 $::command 동봉되어 사실의 가치를 원한다.

2/

당신은 puppet apply에 인수로 $FACTER_command을 통과해서는 안

; 환경 변수로 내보내기 만하면됩니다 (이미 수행 했음).

그래서 님의

변경 puppet apply :

exec { 'some_exec': 
    command => "/bin/bash -c '/some/path/to/scripts.sh -t some_arg ${::command}'", 
    ... 
} 
+0

내가 마음에와 나는 또한 그것을 시도한다는 증서에 있었다 사실, 감사합니다 :

puppet apply site.pp 

변경하려면 간부 오류 상태로 2를 제외하고 같은 오류 :'[0] '중 하나 대신에 2를 반환했습니다. – user1611830

+0

질문했을 때만 대답 할 수 있습니다. 질문을 업데이트하여 시도한 모든 것을 보여줄 수 있습니다. 모든 관련 세부 사항을 찾았습니까? –

+0

내 매니페스트 게시물의 코드를 업데이트하고 내가 얻은 오류를 표시했습니다. – user1611830

관련 문제