diff mbox series

[ovs-dev] rhel: fix logrotate group when dpdk is enabled

Message ID 20190430171019.12642-1-jcaamano@suse.com
State Accepted
Headers show
Series [ovs-dev] rhel: fix logrotate group when dpdk is enabled | expand

Commit Message

Jaime Caamaño Ruiz April 30, 2019, 5:10 p.m. UTC
Otherwise logrotate will fail to generate the rotated log files.

Signed-off-by: Jaime Caamaño Ruiz <jcaamano@suse.com>
---
 rhel/openvswitch-fedora.spec.in | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

Comments

Ilya Maximets Sept. 9, 2020, 5:17 p.m. UTC | #1
On 4/30/19 7:10 PM, Jaime Caamaño Ruiz wrote:
> Otherwise logrotate will fail to generate the rotated log files.
> 
> Signed-off-by: Jaime Caamaño Ruiz <jcaamano@suse.com>
> ---

Hi.  I'm looking through old patches after the patchwork cleanup and this
one seems to be still valid and applicable.

I could apply it if it still needed.  Jaime, what do you think?

Flavio, Aaron, could you, please, take a look at this patch?

Best regards, Ilya Maximets.

>  rhel/openvswitch-fedora.spec.in | 19 ++++++++++---------
>  1 file changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/rhel/openvswitch-fedora.spec.in b/rhel/openvswitch-fedora.spec.in
> index ce728b4f0..01401d5f1 100644
> --- a/rhel/openvswitch-fedora.spec.in
> +++ b/rhel/openvswitch-fedora.spec.in
> @@ -366,18 +366,19 @@ exit 0
>  %post
>  %if %{with libcapng}
>  if [ $1 -eq 1 ]; then
> -    sed -i 's:^#OVS_USER_ID=:OVS_USER_ID=:' /etc/sysconfig/openvswitch
> -    sed -i 's:\(.*su\).*:\1 openvswitch openvswitch:' %{_sysconfdir}/logrotate.d/openvswitch
> -
>  %if %{with dpdk}
> -    sed -i \
> -        's@OVS_USER_ID="openvswitch:openvswitch"@OVS_USER_ID="openvswitch:hugetlbfs"@'\
> -        /etc/sysconfig/openvswitch
> +    %define gname hugetlbfs
> +%else
> +    %define gname openvswitch
>  %endif
> +    sed -i \
> +        's@^#OVS_USER_ID="openvswitch:openvswitch"@OVS_USER_ID="openvswitch:%{gname}"@'\
> +        %{_sysconfdir}/sysconfig/openvswitch
> +    sed -i 's:\(.*su\).*:\1 openvswitch %{gname}:' %{_sysconfdir}/logrotate.d/openvswitch
>  
> -    # In the case of upgrade, this is not needed.
> -    chown -R openvswitch:openvswitch /etc/openvswitch
> -    chown -R openvswitch:openvswitch /var/log/openvswitch
> +    # In the case of upgrade, this is not needed
> +    chown -R openvswitch:openvswitch %{_sysconfdir}/openvswitch
> +    chown -R openvswitch:%{gname} %{_localstatedir}/log/openvswitch
>  fi
>  %endif
>  
>
Flavio Leitner Sept. 15, 2020, 5:10 p.m. UTC | #2
On Tue, Apr 30, 2019 at 07:10:19PM +0200, Jaime Caamaño Ruiz wrote:
> Otherwise logrotate will fail to generate the rotated log files.
> 
> Signed-off-by: Jaime Caamaño Ruiz <jcaamano@suse.com>
> ---

LGTM
Acked-by: Flavio Leitner <fbl@sysclose.org>
Flavio Leitner Sept. 15, 2020, 5:15 p.m. UTC | #3
On Wed, Sep 09, 2020 at 07:17:44PM +0200, Ilya Maximets wrote:
> On 4/30/19 7:10 PM, Jaime Caamaño Ruiz wrote:
> > Otherwise logrotate will fail to generate the rotated log files.
> > 
> > Signed-off-by: Jaime Caamaño Ruiz <jcaamano@suse.com>
> > ---
> 
> Hi.  I'm looking through old patches after the patchwork cleanup and this
> one seems to be still valid and applicable.
> 
> I could apply it if it still needed.  Jaime, what do you think?
> 
> Flavio, Aaron, could you, please, take a look at this patch?

The patch seems to be needed yet, otherwise chown will use the
wrong group in /var/log/openvswitch.

fbl

> 
> Best regards, Ilya Maximets.
> 
> >  rhel/openvswitch-fedora.spec.in | 19 ++++++++++---------
> >  1 file changed, 10 insertions(+), 9 deletions(-)
> > 
> > diff --git a/rhel/openvswitch-fedora.spec.in b/rhel/openvswitch-fedora.spec.in
> > index ce728b4f0..01401d5f1 100644
> > --- a/rhel/openvswitch-fedora.spec.in
> > +++ b/rhel/openvswitch-fedora.spec.in
> > @@ -366,18 +366,19 @@ exit 0
> >  %post
> >  %if %{with libcapng}
> >  if [ $1 -eq 1 ]; then
> > -    sed -i 's:^#OVS_USER_ID=:OVS_USER_ID=:' /etc/sysconfig/openvswitch
> > -    sed -i 's:\(.*su\).*:\1 openvswitch openvswitch:' %{_sysconfdir}/logrotate.d/openvswitch
> > -
> >  %if %{with dpdk}
> > -    sed -i \
> > -        's@OVS_USER_ID="openvswitch:openvswitch"@OVS_USER_ID="openvswitch:hugetlbfs"@'\
> > -        /etc/sysconfig/openvswitch
> > +    %define gname hugetlbfs
> > +%else
> > +    %define gname openvswitch
> >  %endif
> > +    sed -i \
> > +        's@^#OVS_USER_ID="openvswitch:openvswitch"@OVS_USER_ID="openvswitch:%{gname}"@'\
> > +        %{_sysconfdir}/sysconfig/openvswitch
> > +    sed -i 's:\(.*su\).*:\1 openvswitch %{gname}:' %{_sysconfdir}/logrotate.d/openvswitch
> >  
> > -    # In the case of upgrade, this is not needed.
> > -    chown -R openvswitch:openvswitch /etc/openvswitch
> > -    chown -R openvswitch:openvswitch /var/log/openvswitch
> > +    # In the case of upgrade, this is not needed
> > +    chown -R openvswitch:openvswitch %{_sysconfdir}/openvswitch
> > +    chown -R openvswitch:%{gname} %{_localstatedir}/log/openvswitch
> >  fi
> >  %endif
> >  
> > 
> 
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
Ilya Maximets Sept. 16, 2020, 1:50 p.m. UTC | #4
On 9/15/20 7:15 PM, Flavio Leitner wrote:
> On Wed, Sep 09, 2020 at 07:17:44PM +0200, Ilya Maximets wrote:
>> On 4/30/19 7:10 PM, Jaime Caamaño Ruiz wrote:
>>> Otherwise logrotate will fail to generate the rotated log files.
>>>
>>> Signed-off-by: Jaime Caamaño Ruiz <jcaamano@suse.com>
>>> ---
>>
>> Hi.  I'm looking through old patches after the patchwork cleanup and this
>> one seems to be still valid and applicable.
>>
>> I could apply it if it still needed.  Jaime, what do you think?
>>
>> Flavio, Aaron, could you, please, take a look at this patch?
> 
> The patch seems to be needed yet, otherwise chown will use the
> wrong group in /var/log/openvswitch.

Thanks!

Applied to master and backported down to 2.10.

Best regards, Ilya Maximets.
Aaron Conole Sept. 17, 2020, 5:46 p.m. UTC | #5
Ilya Maximets <i.maximets@ovn.org> writes:

> On 4/30/19 7:10 PM, Jaime Caamaño Ruiz wrote:
>> Otherwise logrotate will fail to generate the rotated log files.
>> 
>> Signed-off-by: Jaime Caamaño Ruiz <jcaamano@suse.com>
>> ---
>
> Hi.  I'm looking through old patches after the patchwork cleanup and this
> one seems to be still valid and applicable.
>
> I could apply it if it still needed.  Jaime, what do you think?
>
> Flavio, Aaron, could you, please, take a look at this patch?

It looks like it is valid.

> Best regards, Ilya Maximets.
>
>>  rhel/openvswitch-fedora.spec.in | 19 ++++++++++---------
>>  1 file changed, 10 insertions(+), 9 deletions(-)
>> 
>> diff --git a/rhel/openvswitch-fedora.spec.in b/rhel/openvswitch-fedora.spec.in
>> index ce728b4f0..01401d5f1 100644
>> --- a/rhel/openvswitch-fedora.spec.in
>> +++ b/rhel/openvswitch-fedora.spec.in
>> @@ -366,18 +366,19 @@ exit 0
>>  %post
>>  %if %{with libcapng}
>>  if [ $1 -eq 1 ]; then
>> -    sed -i 's:^#OVS_USER_ID=:OVS_USER_ID=:' /etc/sysconfig/openvswitch
>> -    sed -i 's:\(.*su\).*:\1 openvswitch openvswitch:' %{_sysconfdir}/logrotate.d/openvswitch
>> -
>>  %if %{with dpdk}
>> -    sed -i \
>> -        's@OVS_USER_ID="openvswitch:openvswitch"@OVS_USER_ID="openvswitch:hugetlbfs"@'\
>> -        /etc/sysconfig/openvswitch
>> +    %define gname hugetlbfs
>> +%else
>> +    %define gname openvswitch
>>  %endif
>> +    sed -i \
>> +        's@^#OVS_USER_ID="openvswitch:openvswitch"@OVS_USER_ID="openvswitch:%{gname}"@'\
>> +        %{_sysconfdir}/sysconfig/openvswitch
>> +    sed -i 's:\(.*su\).*:\1 openvswitch %{gname}:' %{_sysconfdir}/logrotate.d/openvswitch
>>  
>> -    # In the case of upgrade, this is not needed.
>> -    chown -R openvswitch:openvswitch /etc/openvswitch
>> -    chown -R openvswitch:openvswitch /var/log/openvswitch
>> +    # In the case of upgrade, this is not needed

I don't see why this comment was changed.

>> +    chown -R openvswitch:openvswitch %{_sysconfdir}/openvswitch

We should make this match by doing:

  chown -R openvswitch:%{gname} %{_sysconfdir}/openvswitch

as well.

>> +    chown -R openvswitch:%{gname} %{_localstatedir}/log/openvswitch
>>  fi
>>  %endif
>>  
>>
Ilya Maximets Sept. 17, 2020, 5:52 p.m. UTC | #6
On 9/17/20 7:46 PM, Aaron Conole wrote:
> Ilya Maximets <i.maximets@ovn.org> writes:
> 
>> On 4/30/19 7:10 PM, Jaime Caamaño Ruiz wrote:
>>> Otherwise logrotate will fail to generate the rotated log files.
>>>
>>> Signed-off-by: Jaime Caamaño Ruiz <jcaamano@suse.com>
>>> ---
>>
>> Hi.  I'm looking through old patches after the patchwork cleanup and this
>> one seems to be still valid and applicable.
>>
>> I could apply it if it still needed.  Jaime, what do you think?
>>
>> Flavio, Aaron, could you, please, take a look at this patch?
> 
> It looks like it is valid.

Yeah.  I already applied it after review from Flavio.

Seems like you fell out of the CC list, sorry.

Best regards, Ilya Maximets.
diff mbox series

Patch

diff --git a/rhel/openvswitch-fedora.spec.in b/rhel/openvswitch-fedora.spec.in
index ce728b4f0..01401d5f1 100644
--- a/rhel/openvswitch-fedora.spec.in
+++ b/rhel/openvswitch-fedora.spec.in
@@ -366,18 +366,19 @@  exit 0
 %post
 %if %{with libcapng}
 if [ $1 -eq 1 ]; then
-    sed -i 's:^#OVS_USER_ID=:OVS_USER_ID=:' /etc/sysconfig/openvswitch
-    sed -i 's:\(.*su\).*:\1 openvswitch openvswitch:' %{_sysconfdir}/logrotate.d/openvswitch
-
 %if %{with dpdk}
-    sed -i \
-        's@OVS_USER_ID="openvswitch:openvswitch"@OVS_USER_ID="openvswitch:hugetlbfs"@'\
-        /etc/sysconfig/openvswitch
+    %define gname hugetlbfs
+%else
+    %define gname openvswitch
 %endif
+    sed -i \
+        's@^#OVS_USER_ID="openvswitch:openvswitch"@OVS_USER_ID="openvswitch:%{gname}"@'\
+        %{_sysconfdir}/sysconfig/openvswitch
+    sed -i 's:\(.*su\).*:\1 openvswitch %{gname}:' %{_sysconfdir}/logrotate.d/openvswitch
 
-    # In the case of upgrade, this is not needed.
-    chown -R openvswitch:openvswitch /etc/openvswitch
-    chown -R openvswitch:openvswitch /var/log/openvswitch
+    # In the case of upgrade, this is not needed
+    chown -R openvswitch:openvswitch %{_sysconfdir}/openvswitch
+    chown -R openvswitch:%{gname} %{_localstatedir}/log/openvswitch
 fi
 %endif