saltstack-formulas / php-formula

http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
Other
57 stars 231 forks source link

Packages Update After Adding PPA #93

Open kdeberna opened 8 years ago

kdeberna commented 8 years ago

I am having an issue when I add in a different PPA in the pillar data to install PHP7.0:

php:
  use_ppa: True
  ppa_name: 'ondrej/php'
  ng:
    version: 7.0
...

The PPA gets added but apt-get update is not run so the php7.0 package isn't found.

I worked around this by adding the update to line 31 of php/ng/installed.jinja:

...
- name: apt-add-repository -y ppa:{{ ppa_name }} && apt-get update
...

I was also looking at lines 36–48 of php/ng/installed.jinja but adding in - refresh_db: True to pkgrepo.managed didn't help.

Is there a method I am overlooking that is in the formula already?

jbouse commented 8 years ago

I can confirm that the lastest clone of the formula fails to perform an 'apt-get update' or 'aptitude update' and refresh the packages DB so that the new packages are not seen when attempting to then install.

jbouse commented 8 years ago

I'm not sure if I've tracked down the issue or not yet but closely examining the output on a host being spun up it looks like the issue lies somewhere within https://github.com/saltstack-formulas/php-formula/blob/master/php/ng/installed.jinja#L29-L48.

I'm basing that on the fact that when I check the output I'm seeing the following while running php.ng state:

      ID: php_ppa_env_php
Function: cmd.run
    Name: apt-add-repository -y ppa:ondrej/php
  Result: True
 Comment: Command "apt-add-repository -y ppa:ondrej/php" run
 Started: 06:54:28.352995
Duration: 1617.397 ms
 Changes:   
          ----------
          pid:
              5734
          retcode:
              0
          stderr:
              gpg: keyring `/tmp/tmpcri5vs44/secring.gpg' created
              gpg: keyring `/tmp/tmpcri5vs44/pubring.gpg' created
              gpg: requesting key E5267A6C from hkp server keyserver.ubuntu.com
              gpg: /tmp/tmpcri5vs44/trustdb.gpg: trustdb created
              gpg: key E5267A6C: public key "Launchpad PPA for Ondřej Surý" imported
              gpg: Total number processed: 1
              gpg:               imported: 1  (RSA: 1)
          stdout:
              OK

      ID: php_ppa_php
Function: pkgrepo.managed
  Result: True
 Comment: Package repo 'php_ppa_php' already configured
 Started: 06:54:29.973055
Duration: 34.138 ms
 Changes:   

      ID: php_ppa_php
Function: pkg.latest
    Name: php
  Result: True
 Comment: State was not run because none of the onchanges reqs changed
 Started: 
Duration: 
 Changes:   

      ID: php_install_php
Function: pkg.installed
    Name: php
  Result: False
 Comment: Problem encountered installing package(s). Additional info follows:

          errors:
              - E: Unable to locate package php5.6
                E: Couldn't find any package by regex 'php5.6'
 Started: 06:54:30.010486
Duration: 2048.657 ms
 Changes:   

the php_ppa_env_php obviously runs as you see the output but then the php_ppa_php that has the pkgrepo.managed and pkg.latest don't execute because 1) the php_ppa_env_php actually installed the source.list entry needed and 2) since php_ppa_php's pkgrepo didn't change so the pkg.latest doesn't fire off.

However if I re-run the php.ng state a second time it will succeed. We're attempting to install PHP 5.6 but should see the same results.