为什么SaltStack pkg.installed命令不识别CentOS 6.6上安装的软件包

时间:2015-01-14 07:55:33

标签: git centos6 salt-stack openjdk

我有一系列在Ubuntu上运行良好的公式,但我发现他们在运行CentOS 6.6版(最终版)时不能正常工作。仆从正在运行盐版本:salt-minion 2014.7.0(Helium)

例如,git-core软件包无法运行:

git-core:
    pkg.installed

当我运行highstate时,我收到此错误:

[user] out: ----------
[user] out: ID: git-core
[user] out: Function: pkg.installed
[user] out: Result: False
[user] out: Comment: Package 'git-core' not found (possible matches: git, wt-git)
[user] out: Changes:   
[user] out: ----------

当我尝试在服务器上手动安装需求时,它们似乎已经安装:

root@host [225 01:41:35 /home/project]# yum install git-core
Loaded plugins: changelog, downloadonly, fastestmirror, security
Setting up Install Process
Loading mirror speeds from cached hostfile
 * epel: mirror.steadfast.net
Package wt-git-1.7.1-1.x86_64 already installed and latest version
Nothing to do

为什么git-core似乎没有找到'通过SaltStack,当它被安装?

顺便说一下,包中有一整套错误,而不仅仅是git,包括:

[user] out: ----------
[user] out:           ID: ssh
[user] out:     Function: service.running
[user] out:       Result: False
[user] out:      Comment: The named service ssh is not available
[user] out:      Changes:   
[user] out: ----------
[user] out:           ID: iptables-persistent
[user] out:     Function: pkg.installed
[user] out:       Result: False
[user] out:      Comment: The following package(s) were not found, and no possible matches were found in the package db: iptables-persistent
[user] out:      Changes:   
[user] out: ----------
[user] out:           ID: iptables-persistent
[user] out:     Function: service.running
[user] out:       Result: False
[user] out:      Comment: The named service iptables-persistent is not available
[user] out:      Changes:   
[user] out: ----------
[user] out:           ID: openjdk-6-jdk
[user] out:     Function: pkg.installed
[user] out:       Result: False
[user] out:      Comment: The following package(s) were not found, and no possible matches were found in the package db: openjdk-6-jdk
[user] out:      Changes:   
[user] out: ----------
[user] out:           ID: tomcat6
[user] out:     Function: pkg.installed
[user] out:       Result: False
[user] out:      Comment: The following packages failed to install/update: tomcat6.
[user] out:      Changes:   
[user] out: ----------

2 个答案:

答案 0 :(得分:0)

看起来这是因为根据os系列,包的名称可能略有不同。

要解决此问题,我将“RedHat”系统的git包名称更新为“wt-git”:

{% if grains['os_family']=="RedHat" %}
wt-git:
    pkg.installed
{% elif grains['os_family']=="Debian" %}
git-core:
    pkg.installed
{% endif %}    

和java:

{% if grains['os_family']=="RedHat" %}

java-1.6.0-openjdk:
    pkg.installed

{% elif grains['os_family']=="Debian" %}

openjdk-6-jdk:
    pkg.installed

{% endif %}    

仍然不确定SSH服务的解决方法是什么。运行不被识别。

答案 1 :(得分:0)

我确定你已经找到了这个,但是为了下一个人,它在我的CentOS盒子上sshd。尝试类似:

{% if grains['os_family']=="RedHat" %}

sshd:
    service.running

{% elif grains['os_family']=="Debian" %}

ssh:
    service.running

{% endif %}