1- %define __python /opt/rh/rh-python38/root/usr/bin/python
1+ %define __python3 python3.12
2+ %define __python3_binary /usr/bin/%{__python3}
3+ %define __psql_version 16
4+ %define __psql_binary /usr/pgsql-%{__psql_version}/bin/psql
5+
26Name: netbox
3- Version: 3.5.4
7+ Version: 4.1.5
48Release: 1
59Summary: The premier source of truth powering network automation.
610
@@ -11,7 +15,7 @@ Source: https://github.com/%{name}-community/%{name}/archive/refs/tags/v%{versio
1115Source2: netbox.logrotate
1216Source3: netbox.logfile
1317
14- Requires: gcc libxml2-devel libxslt-devel libffi-devel libpq5-devel openssl-devel redhat-rpm-config rh-redis6- redis rh-python38 rh-python38-python- pip rh-python38-python -devel
18+ Requires: gcc libxml2-devel libxslt-devel libffi-devel libpq5-devel openssl-devel postgresql%{__psql_version}-server redhat-rpm-config redis pwgen %{__python3} %{__python3}- pip %{__python3} -devel
1519
1620%description
1721NetBox is the source of truth for everything on your network, from physical
@@ -106,21 +110,20 @@ cp %{name}-%{version}/contrib/*.timer %{buildroot}%{_unitdir}
106110
107111%post
108112if [ $1 -eq 1 ]; then
109- systemctl enable --now rh-redis6- redis
113+ systemctl enable --now redis
110114 chown -R nobody /opt/netbox/netbox/{media,reports,scripts}
111115
112- export pgsql_pw=$( pwgen 16 1)
116+ export pgsql_pw=$( pwgen 32 1)
113117 export secret=$( pwgen 64 1)
114118
115- sudo -Hiu postgres /usr/pgsql-13/bin/psql -c ' CREATE DATABASE netbox;' -c " CREATE USER netbox WITH PASSWORD '$pgsql_pw '; ALTER DATABASE netbox OWNER TO netbox;"
116- sudo -Hiu postgres /usr/pgsql-13/bin/psql netbox -c " GRANT CREATE ON SCHEMA public TO netbox;"
119+ sudo -Hiu postgres %{__psql_binary} -c ' CREATE DATABASE netbox;' -c " CREATE USER netbox WITH PASSWORD '$pgsql_pw '; ALTER DATABASE netbox OWNER TO netbox;"
120+ sudo -Hiu postgres %{__psql_binary} netbox -c " GRANT CREATE ON SCHEMA public TO netbox;"
117121
118122 sed -e " s/'PASSWORD': '', # PostgreSQL password/'PASSWORD': '$pgsql_pw ', # PostgreSQL password/" \
119123 -e " s/^SECRET_KEY = ''$/SECRET_KEY = '$secret '/" \
120124 -i /opt/netbox/netbox/netbox/configuration.py
121125
122- source /opt/rh/rh-python38/enable
123- /opt/netbox/upgrade.sh
126+ PYTHON=%{__python3_binary} /opt/netbox/upgrade.sh
124127
125128 chmod -R o-rwx /var/log/netbox
126129 chown -R nobody:nobody /var/log/netbox
@@ -131,5 +134,8 @@ if [ $1 -eq 1 ]; then
131134fi
132135
133136%changelog
137+ * Wed Oct 23 2024 Patrick Reichel <patrick.reichel@nmsprime.com> - 4.1.5-1
138+ - Switch to version 4
139+
134140* Wed Sep 20 2023 Ole Ernst <ole.ernst@nmsprime.com> - 3.5.4-1
135141- Initial RPM release
0 commit comments