2013-12-13 169 views
2

我試圖在使用廚師的獨立機器上部署OpenStack,其烹飪手冊包含在https://github.com/stackforge/openstack-chef-repo中,在此引用爲:http://docs.opscode.com/openstack_repository.html。具體來說,我試圖設置os-compute-single-controller角色。如何運行OpenStack廚師食譜?

我能夠順利上傳食譜。

然而,當我試圖運行我無意中發現了這個錯誤:

Errno::ENOENT 
------------- 
No such file or directory - file not found '/etc/chef/openstack_data_bag_secret' 

Cookbook Trace: 
--------------- 
    /var/chef/cache/cookbooks/openstack-common/libraries/passwords.rb:45:in `secret' 
    /var/chef/cache/cookbooks/openstack-common/libraries/passwords.rb:62:in `db_password' 
    /var/chef/cache/cookbooks/openstack-ops-database/recipes/openstack-db.rb:27:in `from_file' 

Relevant File Content: 
---------------------- 
/var/chef/cache/cookbooks/openstack-common/libraries/passwords.rb: 

38: # That means nova_password will == "nova". 
39: def secret bag_name, index 
40:  if node["openstack"]["developer_mode"] 
41:  return index 
42:  end 
43:  key_path = node["openstack"]["secret"]["key_path"] 
44:  ::Chef::Log.info "Loading encrypted databag #{bag_name}.#{index} using key at #{key_path}" 
45>>  secret = ::Chef::EncryptedDataBagItem.load_secret key_path 
46:  ::Chef::EncryptedDataBagItem.load(bag_name, index, secret)[index] 
47: end 
48: 
49: # Ease-of-use/standardization routine that returns a service password 
50: # for a named OpenStack service. Note that databases are named 
51: # after the OpenStack project nickname, like "nova" or "glance" 
52: def service_password service 
53:  bag = node["openstack"]["secret"]["service_passwords_data_bag"] 
54:  secret bag, service 

我缺少的東西?我不介意寫一個配方來填充這個文件,但我不確定它應該包含哪些內容。我無法在這些食譜的文檔中找到關於此文件的任何內容。

這是我指定的廚師客戶端的配置:

{"run_list":["recipe[apache2]", "role[os-compute-single-controller]"]} 

編輯:

創建一個錯誤的空文件的結果:invalid zero length secret in '/etc/chef/openstack_data_bag_secret'

This似乎有關,儘管是從一個不同的倉庫。但爲什麼this recipe不在stackforge repository

+0

它不應該是一個空文件。它應該是你在數據包中加密數據的關鍵。 –

+0

@Ovesh,如果您有任何與此有關的其他問題,請提供反饋。我願意爲任何稍後可能會退出的人改進此問答。 – Konzula

+0

@Konzula,我確實有更多的問題,但沒有直接關係到這一點。說實話,我已經能夠在迴應之前解決數據包問題。我只是希望有更完整的食譜演練。 – Ovesh

回答

1

由於您的日誌說錯誤實際上在食譜中引發:「stackforge/cookbook-openstack-common」,由class.method ::Chef::EncryptedDataBagItem.load_secret

Here's如何生成祕密文件(包含內容),並將其放在應該在的位置。

請記住,您的祕密文件位置(路徑)保存在your cookbook attribute file中。變量: node["openstack"]["secret"]["key_path"]因此請注意,此變量與文件的實際位置同步。

+1

或者,您可以設置developer_mode屬性並從屬性運行(請參閱回購中的示例環境文件),而不是爲生產設置創建數據庫。 – Karsten