2

LXC を使用して test-kitchen を実行しようとしています。次の.kitchen.ymlを使用すると

driver:
  name: vagrant

provisioner:
  name: chef_solo
platforms:
   - name: ubuntu-12.04
     driver:
       box: precise-lxc
       provider: lxc

kitchen-converge は次の出力で失敗します:

>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: Failed to complete #create action: [Expected process to exit with [0], but received '1'
---- Begin output of vagrant up --no-provision --provider=lxc ----
STDOUT: 
STDERR: The `lxc` package does not seem to be installed or is not accessible on the PATH.
---- End output of vagrant up --no-provision --provider=lxc ----
Ran vagrant up --no-provision --provider=lxc returned 1]
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration

sudo which lxc-create/etc/sudoers でユーザーを「NOPASSWD」に変更しました。.kitchen vagrant up/kitchen-vagrant/default-ubuntu-1204 VM で実行すると、VM が正常に起動し、ホスト システムvagrant sshで実行されていることがわかります。lxc-ls

私はvagrant-lxcコードに飛び込もうとして、一時的にensure_lxc_installedをコメントアウトしました! lib/vagrant-lxc/provider.rb を呼び出します。kitchen converge次のメッセージで失敗しました:

-----> Starting Kitchen (v1.2.1)
-----> Creating <default-ubuntu-1204>...
   Bringing machine 'default' up with 'lxc' provider...
   ==> default: HandleBoxUrl middleware is deprecated. Use HandleBox instead.
   ==> default: This is a bug with the provider. Please contact the creator       
   ==> default: of the provider you use to fix this.
   ==> default: Importing base box 'precise-lxc'...
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: Failed to complete #create action: [Expected process to exit with [0], but received '1'
---- Begin output of vagrant up --no-provision --provider=lxc ----
STDOUT: Bringing machine 'default' up with 'lxc' provider...
==> default: HandleBoxUrl middleware is deprecated. Use HandleBox instead.
==> default: This is a bug with the provider. Please contact the creator
==> default: of the provider you use to fix this.
==> default: Importing base box 'precise-lxc'...
STDERR: There was an error executing ["sudo", "rm", "/usr/share/lxc/templates/lxc-vagrant-tmp-default-ubuntu-1204_default_1399314523513_48531"]

For more information on the failure, enable detailed logging by setting
the environment variable VAGRANT_LOG to DEBUG.
---- End output of vagrant up --no-provision --provider=lxc ----
Ran vagrant up --no-provision --provider=lxc returned 1]
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration

環境:

  • Linux Mint 16、カーネル 3.11.0-20
  • 放浪者 1.5.4
  • vagrant-lxc 0.8
  • テストキッチン 1.2.1
  • lxc 1.0.0~alpha1-0ubuntu14.1
  • 須藤 1.8.6p3-0ubuntu3.1

https://gist.github.com/AlexeyDemidov/11544964の出力kitchen diagnose --all

4

1 に答える 1

2

プラグインソースの 'which lxc-create' への sudo_wrapper 呼び出しを単純な put に置き換えsudo which lxc-createて、sudo には tty が必要であることを示す出力を得ました。/etc/sudoers の「Defaults requiretty」行をコメントアウトすると、この問題が解決しました。

于 2014-05-17T17:47:24.873 に答える