Skip to content

Commit

Permalink
fix: Switch to reading crontab file rather than run the command (#3359)
Browse files Browse the repository at this point in the history
* Based on the comments in bz 1759080, I switched the crontab specs to
  read the crontab files instead of running the command since it does
  user id look ups every time the command is ran. But by switching to
  simple_file the spec would be skipped if the file doesn't exist.

Signed-off-by: Ryan Blakley <[email protected]>
  • Loading branch information
ryan-blakley authored Mar 23, 2022
1 parent acbd829 commit ab819b5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions insights/specs/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ def httpd_cmd(broker):
kdump_conf = simple_file("/etc/kdump.conf")
kernel_config = glob_file("/boot/config-*")
kexec_crash_size = simple_file("/sys/kernel/kexec_crash_size")
keystone_crontab = simple_command("/usr/bin/crontab -l -u keystone")
keystone_crontab = simple_file("/var/spool/cron/keystone")
kpatch_list = simple_command("/usr/sbin/kpatch list")
krb5 = glob_file([r"etc/krb5.conf", r"etc/krb5.conf.d/*"])
ksmstate = simple_file("/sys/kernel/mm/ksm/run")
Expand Down Expand Up @@ -493,7 +493,7 @@ def md5chk_file_list(broker):
"/var/lib/config-data/puppet-generated/nova_libvirt/etc/nova/nova.conf",
"/etc/nova/nova.conf"
])
nova_crontab = simple_command("/usr/bin/crontab -l -u nova")
nova_crontab = simple_file("/var/spool/cron/nova")
nova_uid = simple_command("/usr/bin/id -u nova")
nscd_conf = simple_file("/etc/nscd.conf")
nss_rhel7 = simple_file("/etc/pki/nss-legacy/nss-rhel7.config")
Expand Down
4 changes: 2 additions & 2 deletions insights/specs/insights_archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class InsightsArchiveSpecs(Specs):
ipv4_neigh = simple_file("insights_commands/ip_-4_neighbor_show_nud_all")
ipv6_neigh = simple_file("insights_commands/ip_-6_neighbor_show_nud_all")
iscsiadm_m_session = simple_file("insights_commands/iscsiadm_-m_session")
keystone_crontab = simple_file("insights_commands/crontab_-l_-u_keystone")
keystone_crontab = first_file(["insights_commands/crontab_-l_-u_keystone", "var/spool/cron/keystone"])
kpatch_list = simple_file("insights_commands/kpatch_list")
localtime = simple_file("insights_commands/file_-L_.etc.localtime")
losetup = simple_file("insights_commands/losetup_-l")
Expand Down Expand Up @@ -182,7 +182,7 @@ class InsightsArchiveSpecs(Specs):
netstat_s = simple_file("insights_commands/netstat_-s")
nmcli_conn_show = simple_file("insights_commands/nmcli_conn_show")
nmcli_dev_show = simple_file("insights_commands/nmcli_dev_show")
nova_crontab = simple_file("insights_commands/crontab_-l_-u_nova")
nova_crontab = first_file(["insights_commands/crontab_-l_-u_nova", "var/spool/cron/nova"])
nova_uid = simple_file("insights_commands/id_-u_nova")
ntpq_leap = simple_file("insights_commands/ntpq_-c_rv_0_leap")
ntpq_pn = simple_file("insights_commands/ntpq_-pn")
Expand Down

0 comments on commit ab819b5

Please sign in to comment.