aboutsummaryrefslogtreecommitdiff
path: root/manifests/upgrade_package.pp
blob: 41d5d5205275358f7a9b4425827b0686ab434639 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
define apt::upgrade_package ($version = "") {
  case $version {
    '': {
      exec { "aptitude -y install $name":
        onlyif => [ "grep-status -F Status installed -a -P $name -q", "apt-show-versions -u $name | grep -q upgradeable" ],
      }
    }
    'latest': {
      exec { "aptitude -y install $name":
        onlyif => [ "grep-status -F Status installed -a -P $name -q", "apt-show-versions -u $name | grep -q upgradeable" ],
      }
    }
    default: {
      exec { "aptitude -y install $name=$version":
        onlyif => [ "grep-status -F Status installed -a -P $name -q", "apt-show-versions -u $name | grep -q upgradeable" ],
      }
    }
  }
}