21

I am having a weird issue with having puppet enforce the package nc.

I installed it manually in the end via: yum install nc

I see puppet does it via:
/usr/bin/yum -d 0 -e 0 -y list nc
Returns: Error: No matching Packages to list

I have tested this by command line as well:
yum list nc
Returns Error: No matching Packages to list

Yet, when I do:
yum install nc
Returns: Package 2:nmap-ncat-6.40-4.el7.x86_64 already installed and latest version

What am I missing?

Werner
  • 791
  • 1
  • 6
  • 23

3 Answers3

21

Nc is a link to nmap-ncat.

It would be nice to use nmap-ncat in your puppet, because NC is a virtual name of nmap-ncat.

Puppet cannot understand the links/virtualnames

your puppet should be:

package {
  'nmap-ncat':
    ensure => installed;
}
Vas
  • 461
  • 2
  • 5
  • 1
    Great, that works for 7, but breaks 6.6: Execution of '/usr/bin/yum -d 0 -e 0 -y list nmap-ncat' returned 1: Error: No matching Packages to list Would I have to update my manifests to split on version, or is there another option? – Werner Mar 15 '15 at 02:09
  • [@Werner](http://stackoverflow.com/users/3513601/werner) -- that is what I would do. And hope that they don't break that feature in the future. ;) – Brad Knowles Mar 16 '15 at 22:56
17
yum install nmap-ncat.x86_64

resolved my problem

Robert Houghton
  • 1,202
  • 16
  • 28
wonbin2011
  • 397
  • 3
  • 11
3

You can use a case in this case, to separate versions one example is using FACT os (which returns the version etc of your system... the command facter will return the details:

root@sytem# facter -p os
{"name"=>"CentOS", "family"=>"RedHat", "release"=>{"major"=>"7", "minor"=>"0", "full"=>"7.0.1406"}}

#we capture release hash
$curr_os = $os['release']

case $curr_os['major'] {
  '7': { .... something }
  *: {something}
}

That is an fast example, Might have typos, or not exactly working. But using system facts you can see what happens.

The OS fact provides you 3 main variables: name, family, release... Under release you have a small dictionary with more information about your os! combining these you can create cases to meet your targets.

Vas
  • 461
  • 2
  • 5
  • Took me awhile, but I get it now. This is in response to the @Werner comment about @ VassilisAretakis solution only working in some versions of the OS but not in other versions. So that he could apply different solution based on OS version. OK. – Jesse Chisholm May 12 '20 at 17:34