Webhuis / CFEngine-Roadshow

Free example policies used in the Webhuis CFEngine Roadshow
2 stars 5 forks source link

Zypp for opensuse fails to install #2

Closed Webhuis closed 9 years ago

Webhuis commented 9 years ago

Just put it to the test. Please on rpmosu01.webhuis.nl check /var/cfengine/masterfiles/nano.cf. Remove the package first and then run the policy: cf-agent -KI -f ./nano.cf It works! So it is not zypp, but an error in the packages we feed to zypp. I am working in branch 3.6.2 on the platform policies to resolve the issue.

Test machine rpmosu01.webhuis.nl is an opensuse machine. zypp does run and executes install when run from the commanline. The CFEngine pollicy does not work: bundle agent packages (pkgs_array) { vars: any:: "package_name" slist => getindices("$(pkgs_array)"); packages: "$(package_name)" package_policy => "addupdate", package_method => zypper;

package_version => "$($(pkgs_array)[$(package_name)])";

}

There are issues with package names, but even when very common and valid names are used the ploicy fails.

bundle agent pkg_base_common {

vars:

# packages are defined in the following form:
# "pkg[<pkg-name>]" string => "<pkg-version>";

"pkg[git]"                 string => "*";
"pkg[gzip]"                string => "*";
"pkg[less]"                string => "*";
"pkg[lynx]"                string => "*";
"pkg[mc]"                  string => "*";
"pkg[rsync]"               string => "*";
"pkg[sudo]"                string => "*";

"nopkg[nano]"              string => "*";

methods:

"any" usebundle => packages("pkg_base_common.pkg"); "any" usebundle => nopackages("pkg_base_common.nopkg");

}

gnyers commented 9 years ago

to debug what's going on, last time I've used this strace cmd:

strace -o /tmp/`date -I`_cfengine-run.txt -s 1024 -f -e execve cf-agent -KI
grep exec /tmp/`date -I`_cfengine-run.txt | less

look for zypper install the statement

I've noticed that cf-agent will feed all pkg names to zypper, if only one of them is incorrect, zypper will (naturally) fail. If pkg names are OK, look where the error is occurring.

Webhuis commented 9 years ago

Categorie: Get the packeages right!