Domanda

Sono nuovo a Chef / Opsworks e sto tentando una semplice ricetta per installare Django 1.6 su un'istanza Ubuntu 12.04:

python_pip "Django" do
    version "1.6"
    action :install
end
.

I miei fornitori / pip.rb e provider / virtualenv.rb sembrano ignorare ciò che, apparentemente, era già stato caricato:

DEBUG: Loading cookbook python's providers from /opt/aws/opsworks/releases/20131107153140_213/site-cookbooks/python/providers/pip.rb

DEBUG: Loaded contents of /opt/aws/opsworks/releases/20131107153140_213/site-cookbooks/python/providers/pip.rb into a provider named python_pip defined in Chef::Provider::PythonPip

DEBUG: Loading cookbook python's providers from /opt/aws/opsworks/releases/20131107153140_213/site-cookbooks/python/providers/virtualenv.rb

DEBUG: Loaded contents of /opt/aws/opsworks/releases/20131107153140_213/site-cookbooks/python/providers/virtualenv.rb into a provider named python_virtualenv defined in Chef::Provider::PythonVirtualenv

DEBUG: Loading cookbook python's providers from /opt/aws/opsworks/releases/20131107153140_213/site-cookbooks/python/providers/pip.rb

INFO: PythonPip light-weight provider already initialized -- overriding!

DEBUG: Loaded contents of /opt/aws/opsworks/releases/20131107153140_213/site-cookbooks/python/providers/pip.rb into a provider named python_pip defined in Chef::Provider::PythonPip

DEBUG: Loading cookbook python's providers from /opt/aws/opsworks/releases/20131107153140_213/site-cookbooks/python/providers/virtualenv.rb

INFO: PythonVirtualenv light-weight provider already initialized -- overriding!
.

Ma quando provo ad usare python_pip ricevo un errore:

ERROR: Caught exception while compiling OpsWorks custom run list: NameError - Cannot find a resource for python_pip on ubuntu version 12.04 
.

Ho provato ad aggiungere depends "python" nei miei metadati.rb, ma questo non ha aiutato.Eventuali suggerimenti sono apprezzati.

La mia struttura di directory del mio libro di cucina 'Python':

.
├── python
│   ├── attributes
│   │   └── default.rb
│   ├── metadata.rb
│   ├── providers
│   │   ├── pip.rb
│   │   └── virtualenv.rb
│   ├── recipes
│   │   ├── default.rb
│   │   ├── django.rb
│   │   ├── package.rb
│   │   ├── pip.rb
│   │   ├── source.rb
│   │   └── virtualenv.rb
│   ├── specs
│   │   └── configure_spec.rb
│   └── templates
│       └── default
└── README.md
.

È stato utile?

Soluzione

Non cercare di modificare il libro di cucina Python a meno che non faccia già ciò di cui hai bisogno.La directory dei tuoi libri di cucina dovrebbe essere al minimo come:

cookbooks/
    ├─python/ <clone of https://github.com/poise/python>
    |
    └─application_cookbook/
        ├─recipes/
        |   └─default.rb <containing the resource declaration you have in the question>
        └─metadata.rb <with a `depends "python"` statement in it>
.

Questo è tutto, non c'è bisogno di modificare il libro di cucina Python.Ora imposta la tua linea runlist in [ "python", "application_cookbook" ] e sei a posto.

Altri suggerimenti

Prima di poter utilizzare python_pip LWRP, è necessario avere Python nella tua runlist o include_recipe "python" all'interno della tua ricetta.

Ecco un esempio che presuppone che tu abbia un utente denominato dj con una directory home impostata.

# Note that the recipe will install Python, setuptools and pip
include_recipe "python"


# Create a virtual environment
python_virtualenv '/home/dj/virtenv' do
   interpreter "python2.7"
   owner 'dj'
   group 'dj'
   action :create
end

# Install Django to a virtualenv
python_pip "django" do
   virtualenv '/home/dj/virtenv'
   user 'dj'
   group 'dj'
   action :install
end
.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top