Bug 893593 - yum-cron should use systemd
Summary: yum-cron should use systemd
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: yum
Version: 20
Hardware: All
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: Packaging Maintenance Team
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-01-09 14:45 UTC by jcpunk
Modified: 2014-12-16 19:15 UTC (History)
12 users (show)

Fixed In Version:
Clone Of:
: 1040620 (view as bug list)
Environment:
Last Closed: 2014-12-16 19:15:10 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
patch to modify spec file (2.92 KB, patch)
2013-01-09 14:45 UTC, jcpunk
no flags Details | Diff
yum-cron.service (213 bytes, text/plain)
2013-01-09 14:46 UTC, jcpunk
no flags Details
yum-update.service (103 bytes, text/plain)
2013-07-24 19:22 UTC, Jóhann B. Guðmundsson
no flags Details
yum-update.timer (174 bytes, text/plain)
2013-07-24 19:23 UTC, Jóhann B. Guðmundsson
no flags Details
yum-cleanup.service (104 bytes, text/plain)
2013-07-24 19:25 UTC, Jóhann B. Guðmundsson
no flags Details
yum-cleanup.timer (176 bytes, text/plain)
2013-07-24 19:26 UTC, Jóhann B. Guðmundsson
no flags Details
systemd service file for use with the matching timer (192 bytes, text/plain)
2013-08-20 20:32 UTC, jcpunk
no flags Details
systemd timer file for use with the matching service (157 bytes, text/plain)
2013-08-20 20:33 UTC, jcpunk
no flags Details

Description jcpunk 2013-01-09 14:45:47 UTC
Created attachment 675591 [details]
patch to modify spec file

Description of problem: yum-cron still uses legacy init scripts


Version-Release number of selected component (if applicable): 0.9.2-6.fc19


How reproducible: 100%


Steps to Reproduce:
1. check systemd for yum-cron.service
2. don't find it
  
Actual results: not in systemd


Expected results: in systemd


Additional info:

Comment 1 jcpunk 2013-01-09 14:46:30 UTC
Created attachment 675592 [details]
yum-cron.service

systemd unit file for yum-cron

Comment 2 Habig, Alec 2013-01-09 16:05:54 UTC
Yes, this is needed, and thanks to your patch, should be fairly simple to implement.  However, yum-cron has been subsumed into the main yum package, so I can't make the change: reassigned to the yum package maintainer instead, so he can do it.

Comment 3 Habig, Alec 2013-01-09 16:09:07 UTC
Well, tried to re-assign to Zdenek, but bugzilla didn't take that change.  Added him to the CC list instead: James or Zdenek, could you please change the default assignee of the yum-cron component to the appropriate person?  Thanks!

Comment 4 Zdeněk Pavlas 2013-01-14 08:20:59 UTC
Ported the patch to current HEAD, please review:

http://lists.baseurl.org/pipermail/yum-devel/2013-January/009850.html

Comment 5 James Antill 2013-02-06 21:51:40 UTC
 The [service] definition in the serivce file posted seems to be broken (assumes a long running daemon), changing it to:

type=oneshot
RemainAfterExit=true

...seems to make it work.

 Also there is no conversion, so any installed+working yum-cron services will switch off after upgrade ... I _think_:

if [ -f /var/lock/subsys/yum-cron -a -f /etc/rc.d/init.d/yum-cron ]; then
 systemctl enable yum-cron
fi

...will dtrt, but not tested atm. as I'd already moved all my machines to the newer yum-cron.

 Any comments?

Comment 6 James Antill 2013-02-06 22:05:11 UTC
Also we need to find out how to make "systemctl preset yum-cron" be enabled.

Comment 7 Jóhann B. Guðmundsson 2013-02-27 21:30:48 UTC
(In reply to comment #6)
> Also we need to find out how to make "systemctl preset yum-cron" be enabled.

What exactly is the purpose of this initscrip mean why is it needed as opposed to just run as a regular cron job since this looks awfully like a hack and the moodle maintainer duplicated this + it seems to be the underlying bug of #909720 )

We also have systemd timer units this could be migrated to ( if applicable ) and  you will need to file a request against systemd for it to be added to the preset file

Comment 8 Jóhann B. Guðmundsson 2013-02-27 21:32:52 UTC
(In reply to comment #1)
> Created attachment 675592 [details]
> yum-cron.service
> 
> systemd unit file for yum-cron

If you are migrating unit files I kindly ask you to provide your name along with the bugs you file here [1] and have a look if those files have been already migrated which you can see here [2] before doing so.

1. http://fedoraproject.org/wiki/User:Johannbg/Features/SysVtoSystemd-F19
2. http://fedoraproject.org/wiki/User:Johannbg/Features/SysVtoSystemd-F17

Comment 9 Jóhann B. Guðmundsson 2013-02-27 21:51:05 UTC
And I should mention as well that this ought to be a type oneshot unit not type simple...

Comment 10 James Antill 2013-02-28 16:14:38 UTC
(In reply to comment #7)
> (In reply to comment #6)
> > Also we need to find out how to make "systemctl preset yum-cron" be enabled.
> 
> What exactly is the purpose of this initscrip mean why is it needed as
> opposed to just run as a regular cron job since this looks awfully like a
> hack and the moodle maintainer duplicated this + it seems to be the
> underlying bug of #909720 )

 So you can easily turn the service off, without having to uninstall the package

> We also have systemd timer units this could be migrated to ( if applicable )
> and  you will need to file a request against systemd for it to be added to
> the preset file

 AIUI timer units shouldn't be used before at least F19, maybe F20 ... it's likely we'll move to them when they are available.(In reply to comment #9)

(In reply to comment #9)
> And I should mention as well that this ought to be a type oneshot unit not
> type simple...

Yeh, I said that in comment #5 and fixed it upstream and in rawhide.

Comment 11 Jóhann B. Guðmundsson 2013-02-28 17:19:41 UTC
(In reply to comment #10)
> (In reply to comment #7)
> > (In reply to comment #6)
> > > Also we need to find out how to make "systemctl preset yum-cron" be enabled.
> > 
> > What exactly is the purpose of this initscrip mean why is it needed as
> > opposed to just run as a regular cron job since this looks awfully like a
> > hack and the moodle maintainer duplicated this + it seems to be the
> > underlying bug of #909720 )
> 
>  So you can easily turn the service off, without having to uninstall the
> package

 Disabling what service this is not a daemon you are running there, you mean disabling the cron job right? 

What exactly problem is that initscript trying to solve?

> 
> > We also have systemd timer units this could be migrated to ( if applicable )
> > and  you will need to file a request against systemd for it to be added to
> > the preset file
> 
>  AIUI timer units shouldn't be used before at least F19, maybe F20 ... it's
> likely we'll move to them when they are available.(In reply to comment #9)

? 

Timer units have been there since we pushed systemd into Fedora and have been usable since then. 

Lennarts feature request is just about them gaining calendar date support that's it 

The biggest feature of using timer units is to tie them to the startup of your daemon/service ( which this hack you are doing is not ) so when you effectively start up a daemon you "enable" the cron job which then get runs on what ever time interval it has been configured to run, then when you disable the daemon/service you effectively disable the cron job at the same.

Comment 12 Jóhann B. Guðmundsson 2013-02-28 17:27:00 UTC
The proper way for administrators to enable and disable this is literally touching and removing the /var/lock/subsys/yum-cron if they wanted to enable or disable this instead of using this initscript hack

Comment 13 Habig, Alec 2013-02-28 18:41:52 UTC
Before everyone gets too wound up about the enabling style, I would like to point out that the current "hack" was made way back when yum was brand new, and before all these new, spiffier methods existed.  The problem it was trying to solve was to provide an enable/disable means (short of uninstalling) consistent with the way everything else in the system was using.  This was back in the days when "chkconfig" had just been stolen from IRIX and was viewed as the newest, spiffiest, cleanest way of doing things.  And it worked, so there was no incentive to change it.

Now that newer, spiffier, cleaner, more fashionable methods exist, just code them up instead of griping about it.

Comment 14 Orion Poplawski 2013-07-24 18:27:42 UTC
Ping?  Has anyone tried to use timers for this?

Comment 15 Jóhann B. Guðmundsson 2013-07-24 19:17:29 UTC
I thought this was being deprecated in favour of comment 13 anyway doing so is not a big problem the question should just become if yum-cron should not then be deprecated since the yum cron script overlaps with the timer settings in the units?  

Give me sec and I'll post 4 units

Comment 16 Jóhann B. Guðmundsson 2013-07-24 19:22:41 UTC
Created attachment 777938 [details]
yum-update.service

Comment 17 Jóhann B. Guðmundsson 2013-07-24 19:23:36 UTC
Created attachment 777939 [details]
yum-update.timer

Comment 18 Jóhann B. Guðmundsson 2013-07-24 19:25:35 UTC
Created attachment 777940 [details]
yum-cleanup.service

Comment 19 Jóhann B. Guðmundsson 2013-07-24 19:26:49 UTC
Created attachment 777941 [details]
yum-cleanup.timer

Comment 20 Jóhann B. Guðmundsson 2013-07-24 19:31:33 UTC
Note I just threw this together it does not update with the parameters in the yum-cron script nor does it send mail ( which outputs probably would need do be fetch from the journal with this move )

Comment 21 jcpunk 2013-08-20 20:32:26 UTC
Created attachment 788639 [details]
systemd service file for use with the matching timer

Based on Fedora 19, there is a more direct way of kicking off the yum-cron job.  I've got a unit file for the service and the timer (but not for the 'hourly' job)

Comment 22 jcpunk 2013-08-20 20:33:11 UTC
Created attachment 788641 [details]
systemd timer file for use with the matching service

Comment 23 Jóhann B. Guðmundsson 2013-08-20 20:36:35 UTC
(In reply to jcpunk from comment #22)
> Created attachment 788641 [details]
> systemd timer file for use with the matching service

Was that you that was working on this at flock? 

If not this might be taken care of already by the yum maintainers themselves

Comment 24 jcpunk 2013-08-20 20:38:32 UTC
Nope, not me - I'm just a VERY interested party.

Comment 25 Jan Zeleny 2013-08-21 06:29:20 UTC
For the record, I am not aware of any yum developer working on this at Flock so it is possible that it was someone else who was very interested in this.

Comment 26 jcpunk 2013-10-21 19:37:44 UTC
looks like there was work to get systemd and yum-cron into FC20.  The Spec has entries for it, but the package doesn't seem to have built right to utilize it:

http://koji.fedoraproject.org/koji/buildinfo?buildID=469738

yum_cron_systemd seems to have ended up as '0'

Comment 27 jcpunk 2013-11-11 20:37:03 UTC
Looks like yum-cron installs systemd servies in yum-cron-3.4.3-114.fc21.noarch.rpm

( http://koji.fedoraproject.org/koji/buildinfo?buildID=477523 )


Note You need to log in before you can comment on or make changes to this bug.