Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

list all vmdb directories in the gem #352

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kbrock
Copy link
Member

@kbrock kbrock commented Dec 13, 2022

Overview

Fixes #332

The goal is to remove a warning:

warning: File listed twice: /var/www/miq/vmdb/certs
(a few hundred files do this)

Before

%defattr(-,root,root,-)
%{app_root}
%attr(-,manageiq,manageiq) %{app_root}/certs

We stated that we included all files recursively under app_root (/var/www/miq/vmdb).
Then we stated a few directories (with different privileges) under app_root.
So we ended up with duplicates.

Why?

Most app_root subdirectories are owned by root, which is the default, so using the app_root line works.

There are a few config directories that need to be editable and owned by the end user. That is why they are listed with the %attr() syntax.

After

We explicitly listed each folder in the rails root.

I would have liked to keep on using the app_root rule so any additional files would be auto added.

This is tricky because we tend to not debug the directory listing of the rpm So there is a good chance that we will add a directory to app_root (vmdb / manageiq-core root) and will think it is all set but will fail on the appliance.

Overview
========

Fixes ManageIQ#332

The goal is to remove a warning:

```
warning: File listed twice: /var/www/miq/vmdb/certs
(a few hundred files do this)
```

Before
======

```
%defattr(-,root,root,-)
%{app_root}
%attr(-,manageiq,manageiq) %{app_root}/certs
```

We stated that we included all files recursively under app_root (/var/www/miq/vmdb).
Then we stated a few directories (with different privileges) under app_root.
So we ended up with duplicates.


Why?
====

Most app_root subdirectories are owned by root, which is the default, so using the app_root line works.

There are a few config directories that need to be editable and owned by the end user. That is why they are listed with the `%attr()` syntax.

After
=====

We explicitly listed each folder in the rails root.

I would have liked to keep on using the app_root rule so any additional files would be auto added.

This is tricky because we tend to not debug the directory listing of the `rpm` So there is a good chance that we will add a directory to app_root (vmdb / manageiq-core root) and will think it is all set but will fail on the appliance.
@kbrock kbrock added the bug Something isn't working label Dec 13, 2022
@@ -55,12 +55,38 @@ done

%files core
%defattr(-,root,root,-)
%{app_root}
%{app_root}/AUTHORS
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we also need to add a %dir %{app_root} for the directory itself?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so %dir says to add a directory only and not the files underneath it.

I was pretty sure that adding the file app_root/AUTHORS (in addition to the next 10
lines) would add app_root with the default attributes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on what I'm reading we probably need %dir for app_root, since we want the rpm to own that dir.

@Fryguy
Copy link
Member

Fryguy commented Dec 15, 2022

I'm concerned keeping this up to date will be a pain - I wonder if we can leverage %exclude to make it work? Something like the following?

%files core
%defattr(-,root,root,-)
%{app_root}
%exclude %{app_root}/certs
%attr(-,manageiq,manageiq) %{app_root}/certs
%exclude %{app_root}/config
%attr(-,manageiq,manageiq) %{app_root}/config
%exclude %{app_root}/log
%attr(-,manageiq,manageiq) %{app_root}/log
%exclude %{app_root}/tmp
%attr(-,manageiq,manageiq) %{app_root}/tmp
%exclude %{app_root}/data
%attr(-,manageiq,manageiq) %{app_root}/data
%config(noreplace) %{app_root}/config/cable.yml
%exclude %{app_root}/public/pictures
%exclude %{app_root}/public/assets
...

@kbrock
Copy link
Member Author

kbrock commented Dec 19, 2022

a. I'm very concerned about keeping this up to date
b. the exclude rule is the first one I tried

I'll try one more time with the %exclude operations.
The rpms were missing the directories last time I tries
The last I'm pretty sure it did not include any of those directories

Alternatives

Our big issue is that we are trying to put down a directory with both code and user data there.

  1. Put the user files elsewhere (e.g.: copy daemons like httpd and put config in /etc/httpd)
  2. Just set everything owned by manageiq user (code and config files) and be done with it
  3. Put the user files into a separate rpm (where everything is miq owned)

@kbrock
Copy link
Member Author

kbrock commented Dec 20, 2022

yea, just tried the exclude example again. it is so clean but it does not work

%defattr(-,root,root,-)
%{app_root}
%exclude %{app_root}/certs
%exclude %{app_root}/config
%exclude %{app_root}/data
%exclude %{app_root}/log
%exclude %{app_root}/tmp
%attr(-,manageiq,manageiq) %{app_root}/certs
%attr(-,manageiq,manageiq) %{app_root}/config
%attr(-,manageiq,manageiq) %{app_root}/data
%attr(-,manageiq,manageiq) %{app_root}/log
%attr(-,manageiq,manageiq) %{app_root}/tmp
%config(noreplace) %{app_root}/config/cable.yml
%exclude %{app_root}/public/pictures
%exclude %{app_root}/public/assets

@miq-bot miq-bot added the stale label Mar 27, 2023
@miq-bot
Copy link
Member

miq-bot commented Mar 27, 2023

This pull request has been automatically marked as stale because it has not been updated for at least 3 months.

If these changes are still valid, please remove the stale label, make any changes requested by reviewers (if any), and ensure that this issue is being looked at by the assigned/reviewer(s)

Thank you for all your contributions! More information about the ManageIQ triage process can be found in the triage process documentation.

@miq-bot miq-bot closed this Jul 3, 2023
@miq-bot
Copy link
Member

miq-bot commented Jul 3, 2023

This pull request has been automatically closed because it has not been updated for at least 3 months.

Feel free to reopen this pull request if these changes are still valid.

Thank you for all your contributions! More information about the ManageIQ triage process can be found in the triage process documentation.

@kbrock
Copy link
Member Author

kbrock commented Jul 27, 2023

think our current suggestion is to extract user content into its own gem and have all of those files owned by manageiq user

@kbrock kbrock reopened this Jul 27, 2023
@kbrock kbrock removed the stale label Jul 27, 2023
@miq-bot
Copy link
Member

miq-bot commented Jul 27, 2023

Checked commit kbrock@80b19f9 with ruby 2.6.10, rubocop 1.28.2, haml-lint 0.35.0, and yamllint
0 files checked, 0 offenses detected
Everything looks fine. 👍

@miq-bot
Copy link
Member

miq-bot commented Oct 30, 2023

This pull request has been automatically marked as stale because it has not been updated for at least 3 months.

If these changes are still valid, please remove the stale label, make any changes requested by reviewers (if any), and ensure that this issue is being looked at by the assigned/reviewer(s)

Thank you for all your contributions! More information about the ManageIQ triage process can be found in the triage process documentation.

@miq-bot miq-bot added the stale label Oct 30, 2023
@miq-bot
Copy link
Member

miq-bot commented Feb 5, 2024

This pull request has been automatically marked as stale because it has not been updated for at least 3 months.

If these changes are still valid, please remove the stale label, make any changes requested by reviewers (if any), and ensure that this issue is being looked at by the assigned/reviewer(s).

2 similar comments
@miq-bot
Copy link
Member

miq-bot commented May 6, 2024

This pull request has been automatically marked as stale because it has not been updated for at least 3 months.

If these changes are still valid, please remove the stale label, make any changes requested by reviewers (if any), and ensure that this issue is being looked at by the assigned/reviewer(s).

@miq-bot
Copy link
Member

miq-bot commented Aug 12, 2024

This pull request has been automatically marked as stale because it has not been updated for at least 3 months.

If these changes are still valid, please remove the stale label, make any changes requested by reviewers (if any), and ensure that this issue is being looked at by the assigned/reviewer(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RPM build warnings for "File listed twice"
4 participants