summaryrefslogtreecommitdiff
path: root/manifests/upgrade_package.pp
blob: 99e9c2aaaacb21bfacf34a2993c90e7aa2ddb250 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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" ],
      }
    }
  }
}