import os
from kokki import Execute, Package

apt_list_path = '/etc/apt/sources.list.d/pitti-postgresql-lucid.list'

Execute("apt-update-postgresql9",
    command = "apt-get update",
    action = "nothing")

apt = None
if env.system.platform == "ubuntu":
    Package("python-software-properties")
    Execute("add-apt-repository ppa:pitti/postgresql",
        not_if = lambda:os.path.exists(apt_list_path),
        notifies = [("run", env.resources["Execute"]["apt-update-postgresql9"], True)])

import os
from kokki import Execute, Package

if not (env.system.platform == "ubuntu" and env.system.lsb['release'] in ["11.10"]):
    apt_list_path = '/etc/apt/sources.list.d/pitti-postgresql-lucid.list'

    Execute("apt-update-postgresql9",
        command = "apt-get update",
        action = "nothing")

    apt = None
    if env.system.platform == "ubuntu":
        Package("python-software-properties")
        Execute("add-apt-repository ppa:pitti/postgresql",
            not_if = lambda:os.path.exists(apt_list_path),
            notifies = [("run", env.resources["Execute"]["apt-update-postgresql9"], True)])

Use standard repo for postgresql9 in ubuntu 11.10
Use standard repo for postgresql9 in ubuntu 11.10

  import os
  from kokki import Execute, Package
  
+ if not (env.system.platform == "ubuntu" and env.system.lsb['release'] in ["11.10"]):
- apt_list_path = '/etc/apt/sources.list.d/pitti-postgresql-lucid.list'
+     apt_list_path = '/etc/apt/sources.list.d/pitti-postgresql-lucid.list'
  
- Execute("apt-update-postgresql9",
+     Execute("apt-update-postgresql9",
-     command = "apt-get update",
+         command = "apt-get update",
-     action = "nothing")
+         action = "nothing")
  
- apt = None
+     apt = None
- if env.system.platform == "ubuntu":
+     if env.system.platform == "ubuntu":
-     Package("python-software-properties")
+         Package("python-software-properties")
-     Execute("add-apt-repository ppa:pitti/postgresql",
+         Execute("add-apt-repository ppa:pitti/postgresql",
-         not_if = lambda:os.path.exists(apt_list_path),
+             not_if = lambda:os.path.exists(apt_list_path),
-         notifies = [("run", env.resources["Execute"]["apt-update-postgresql9"], True)])
+             notifies = [("run", env.resources["Execute"]["apt-update-postgresql9"], True)])
  
Use standard repo for postgresql9 in ubuntu 11.10
## Code Before:
import os
from kokki import Execute, Package

apt_list_path = '/etc/apt/sources.list.d/pitti-postgresql-lucid.list'

Execute("apt-update-postgresql9",
    command = "apt-get update",
    action = "nothing")

apt = None
if env.system.platform == "ubuntu":
    Package("python-software-properties")
    Execute("add-apt-repository ppa:pitti/postgresql",
        not_if = lambda:os.path.exists(apt_list_path),
        notifies = [("run", env.resources["Execute"]["apt-update-postgresql9"], True)])

## Instruction:
Use standard repo for postgresql9 in ubuntu 11.10
## Code After:
import os
from kokki import Execute, Package

if not (env.system.platform == "ubuntu" and env.system.lsb['release'] in ["11.10"]):
    apt_list_path = '/etc/apt/sources.list.d/pitti-postgresql-lucid.list'

    Execute("apt-update-postgresql9",
        command = "apt-get update",
        action = "nothing")

    apt = None
    if env.system.platform == "ubuntu":
        Package("python-software-properties")
        Execute("add-apt-repository ppa:pitti/postgresql",
            not_if = lambda:os.path.exists(apt_list_path),
            notifies = [("run", env.resources["Execute"]["apt-update-postgresql9"], True)])
