# Packages aren't installing on Ubuntu

Good morning, I am trying to manage packages with puppet, and it is working on my RHEL/CentOS, but not my Ubuntu servers, and I cannot figure out why. The code is as follows:

  case $operatingsytem { 'Ubuntu': { Package { ensure => "installed" }$system_packages = [
'nmap',
'etc...',
]
package { $system_packages: } }  I'm at a complete loss here. Thanks in advance for any assistance! edit retag close merge delete ## Comments There are no errors, it just simply is not installing the packages. ( 2016-11-11 11:02:07 -0500 )edit ## 1 Answer Sort by » oldest newest most voted You are using a case statement without a default option. So what is happening is if$operatingsystem == 'Ubuntu', then you are installing the packages, but other options have a 'no-op' because they don't match.

if you add a default evaluation, you'll see what I'm talking about..

  case $operatingsytem { 'Ubuntu': { Package { ensure => "installed" }$system_packages = [
'nmap',
'etc...',
]
package { $system_packages: } default => { fail("Operating system$operatingsystem not supported")}
} #This was missing in your example
}


If you run the above, you'll see that on the non-Ubuntu systems, it will fail because it enters the 'default' block (which previously was empty due to not declaring it)

more

But it is Ubuntu, and the packages are just not installing.

( 2016-11-11 11:17:50 -0500 )edit

Are they already installed, so it's not showing you, or are they not installed on the box at all? on the cli, run (puppet resource package ) and see what status it shows for your packages...

( 2016-11-11 14:38:14 -0500 )edit

No, I can manually install the packages after puppet runs. I fixed it, but I'm still not sure what the problem is. I deleted the CentOS case statements, then ran puppet without them and it worked. Then I readded the CentOS case statement, and it still works. It's working now, so I'll take it.

( 2016-11-11 15:39:04 -0500 )edit

I wonder if you had a misplaced pair of { } somewhere, and that was causing your code to not behave as you would have expected. If you have an IDE that supports code reformatting and the prior non-working commit, try formatting the code.

( 2016-11-14 09:21:02 -0500 )edit

I deleted 'RHEL', 'CentOS': { } and it worked fine. I readded the same snippet, and it still worked. I'm not really sure where the issue was, but I never got any errors saying I had an unexpected character. You could be right, it just didn't tell me anything. All is good now, though! Thanks!

( 2016-11-14 11:42:47 -0500 )edit