Forum: CFEngine Help Subject: Cfengine isn't discovering all of your Solaris packages? This is why. Author: msvob...@linkedin.com Link to topic: https://cfengine.com/forum/read.php?3,23948,23948#msg-23948
Last week, I worked with Eystein Stenberg and Diego Zamboni on an issue where a certain number of Solaris packages were not being discovered by the Cfengine package manager. In the cfengine_stdlib.cf standard library, a body exists for dealing with Solaris packages: Unmodified, you'll find this: body package_method solaris (pkgname, spoolfile, adminfile) { package_changes => "individual"; package_file_repositories => { "/var/cfengine/inputs/config-solaris/PKGS" }; package_list_command => "/usr/bin/pkginfo -l"; package_multiline_start => "\s*PKGINST:\s+[^\s]+"; package_list_name_regex => "\s*PKGINST:\s+([^\s]+)"; package_list_version_regex => "\s*VERSION:\s+([^\s]+)"; package_list_arch_regex => "\s*ARCH:\s+([^\s]+)"; package_installed_regex => "\s*STATUS:\s*(completely|partially)\s+installed.*"; package_name_convention => "$(name)"; package_add_command => "/usr/sbin/pkgadd -n -a $(adminfile) -d $(spoolfile)"; package_delete_command => "/usr/sbin/pkgrm -n -a $(adminfile)"; package_verify_command => "/usr/bin/pkginfo"; } I noticed that several of our "internally built" packages were not being discovered. This was due to whitespace not being gobbled up by the following: package_multiline_start => "\s*PKGINST:\s+[^\s]+"; package_list_name_regex => "\s*PKGINST:\s+([^\s]+)"; package_list_version_regex => "\s*VERSION:\s+([^\s]+)"; So in short, add a .* to the end of these statements like so: package_multiline_start => "\s*PKGINST:\s+[^\s]+.*"; package_list_name_regex => "\s*PKGINST:\s+([^\s]+).*"; package_list_version_regex => "\s*VERSION:\s+([^\s]+).*"; This may help the Cfengine package parser pick up packages that it didn't detect before. This is my full Solaris package template: body package_method solaris (pkgname, spoolfile, adminfile) { package_changes => "individual"; package_list_command => "/usr/bin/pkginfo -l"; package_multiline_start => "\s*PKGINST:\s+[^\s]+.*"; package_list_name_regex => "\s*PKGINST:\s+([^\s]+).*"; package_list_version_regex => "\s*VERSION:\s+([^\s]+).*"; package_list_arch_regex => "\s*ARCH:\s+([^\s]+).*"; package_installed_regex => "\s*STATUS:\s*(completely|partially)\s+installed.*"; package_name_convention => "$(name)"; package_add_command => "/usr/sbin/pkgadd -n -a $(adminfile) -d $(spoolfile)"; package_delete_command => "/usr/sbin/pkgrm -n -a $(adminfile)"; package_verify_command => "/usr/bin/pkginfo"; } Hope this helps someone else running into an issue with internally built Solaris packages not being detected in their promises. Cheers Mike _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine