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

Unbreak RPM builds, add to Travis, add rpm support for collectors 300 directory #430

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
language: python
sudo: true
dist: "xenial"
python:
- "2.7"
Expand All @@ -7,7 +8,9 @@ python:
- "3.6"
- "3.7"
install:
- sudo apt-get update && sudo apt-get install -y rpm
- pip install pylint pylint_runner ordereddict mysqlclient requests feedparser prometheus_client flask
script:
- cd rpm && make all && cd ..
- pylint_runner --rcfile .pylintrc
- ./tests.py
16 changes: 15 additions & 1 deletion rpm/tcollector.spec
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ package will install the tcollector.py along with

%install
mkdir -p %{buildroot}/%{collectorsdir}/0/
mkdir -p %{buildroot}/%{collectorsdir}/300/
mkdir -p %{buildroot}/etc/init.d/

# set homedir in init script
Expand All @@ -37,14 +38,17 @@ mkdir -p %{buildroot}/etc/init.d/

# Install Base files
mkdir -p %{buildroot}%{tcollectordir}/collectors/lib/
mkdir -p %{buildroot}%{tcollectordir}/collectors/lib/docker_engine/
mkdir -p %{buildroot}%{tcollectordir}/collectors/etc/
%{__install} -m 0755 -D %{srccollectors}/__init__.py %{buildroot}%{tcollectordir}/collectors/
%{__install} -m 0755 -D %{srccollectors}/lib/* %{buildroot}%{tcollectordir}/collectors/lib/
%{__install} -m 0755 -D %{srccollectors}/lib/*.* %{buildroot}%{tcollectordir}/collectors/lib/
%{__install} -m 0755 -D %{srccollectors}/lib/docker_engine/* %{buildroot}%{tcollectordir}/collectors/lib/docker_engine/
%{__install} -m 0755 -D %{srccollectors}/etc/* %{buildroot}%{tcollectordir}/collectors/etc/
%{__install} -m 0755 -D %{rootdir}/tcollector.py %{buildroot}%{tcollectordir}/

# Install Collectors
%{__install} -m 0755 -D %{srccollectors}/0/* %{buildroot}%{collectorsdir}/0/
%{__install} -m 0755 -D %{srccollectors}/300/* %{buildroot}%{collectorsdir}/300/

# Install EOS files
%{__install} -m 0755 -D %{eosdir}/collectors/agent*.sh %{buildroot}/%{collectorsdir}/0/
Expand All @@ -55,6 +59,16 @@ mkdir -p %{buildroot}/%{py2_sitelib}/
%{__install} -m 0755 -D %{eosdir}/tcollector_agent.py %{buildroot}/%{py2_sitelib}/


# Modern rpmbuild wants either python2 or python3
%{__perl} -pe "s|/usr/bin/env python|/usr/bin/env python2|;" -i %{buildroot}%{tcollectordir}/*.py
%{__perl} -pe "s|/usr/bin/env python|/usr/bin/env python2|;" -i %{eosdir}/tcollector_agent.py %{buildroot}/%{py2_sitelib}/*.py
%{__perl} -pe "s|/usr/bin/env python|/usr/bin/env python2|;" -i %{buildroot}%{tcollectordir}/collectors/etc/*.py
%{__perl} -pe "s|/usr/bin/env python|/usr/bin/env python2|;" -i %{buildroot}%{tcollectordir}/collectors/0/*.py
%{__perl} -pe "s|/usr/bin/env python|/usr/bin/env python2|;" -i %{buildroot}%{tcollectordir}/collectors/300/*.py
%{__perl} -pe "s|/usr/bin/env python|/usr/bin/env python2|;" -i %{buildroot}%{tcollectordir}/collectors/lib/*.py
%{__perl} -pe "s|/usr/bin/env python|/usr/bin/env python2|;" -i %{buildroot}%{tcollectordir}/collectors/lib/docker_engine/*.py
%{__perl} -pe "s|/usr/bin/env python|/usr/bin/env python2|;" -i %{buildroot}/usr/bin/tcollector

%files
%dir %{tcollectordir}
%attr(755, -, -) /etc/init.d/tcollector
Expand Down