Skip to content

Commit

Permalink
Auto-generate lago.conf in RPM spec file
Browse files Browse the repository at this point in the history
This will install the auto-generated lago.conf
inside /etc/lago/lago.conf, all commented-out.
  • Loading branch information
nvgoldin committed Oct 10, 2016
1 parent 0dad890 commit a771a9d
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 23 deletions.
13 changes: 0 additions & 13 deletions etc/lago.d/lago.conf

This file was deleted.

41 changes: 32 additions & 9 deletions lago.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,20 @@ Deploy and tear down environments of several virtual machines
%setup -q -n %{name}-%{version}

%build
LAGO_VERSION=%{version} %{__python} setup.py build
LAGO_VERSION=%{version} %{py2_build}

%install
LAGO_VERSION=%{version} %{__python} setup.py install --root $RPM_BUILD_ROOT
cd "$RPM_BUILD_DIR"

install -d "$RPM_BUILD_ROOT"/var/lib/lago/subnets
install -d "$RPM_BUILD_ROOT"/var/lib/lago/store
install -d "$RPM_BUILD_ROOT"/var/lib/lago/repos
LAGO_VERSION=%{version} %{py2_install}
install -d -m 755 %{buildroot}/%{_sysconfdir}/lago
PYTHONPATH="$PYTHONPATH:%{buildroot}/%{python_sitelib}"\
%{buildroot}/usr/bin/lago --ignore-warnings generate-config > "%{buildroot}/%{_sysconfdir}/lago/lago.conf"
sed -i 's/^\([^#]\)\(.*\)/#\0/' "%{buildroot}/%{_sysconfdir}/lago/lago.conf"

install -d %{buildroot}/var/lib/lago/subnets
install -d %{buildroot}/var/lib/lago/store
install -d %{buildroot}/var/lib/lago/repos
# this is for python-lago-ovirt
install -d "$RPM_BUILD_ROOT"/var/lib/lago/reposync
install -d %{buildroot}/var/lib/lago/reposync

%files

Expand All @@ -39,6 +42,23 @@ Summary: Library to perform lago operations
BuildArch: noarch
BuildRequires: python2-devel
BuildRequires: python-pbr
BuildRequires: python-stevedore
BuildRequires: python-setuptools
BuildRequires: python-magic
BuildRequires: python-lockfile
BuildRequires: python-yaml
BuildRequires: pyxdg
BuildRequires: python-xmltodict
BuildRequires: python-lxml
BuildRequires: libvirt-python
BuildRequires: python-enum
BuildRequires: python-scp
%if 0%{?fedora} >= 24
BuildRequires: python2-configparser
%else
BuildRequires: python-configparser
%endif

%if 0%{?fedora} >= 23
BuildRequires: python2-dulwich
%else
Expand Down Expand Up @@ -88,12 +108,13 @@ Requires: sudo
%{_bindir}/lagocli
%{_bindir}/lago
%attr(0775, root, root) %{_sysconfdir}/sudoers.d/*
%config(noreplace) %{_sysconfdir}/lago.d/lago.conf
%config(noreplace) %{_sysconfdir}/lago/lago.conf
%dir %attr(2775, root, lago) /var/lib/lago/
%dir %attr(2775, root, lago) /var/lib/lago/subnets/
%dir %attr(2775, root, lago) /var/lib/lago/store/
%dir %attr(2775, root, lago) /var/lib/lago/repos/


%pre -n python-%{name}
if [[ "$1" -eq 1 ]]; then
groupadd lago
Expand All @@ -104,6 +125,7 @@ if [[ "$1" -eq 0 ]]; then
groupdel lago
fi


###################### lago-ovirt package
%package -n %{name}-ovirt
Summary: oVirt extension for lagocli
Expand Down Expand Up @@ -147,6 +169,7 @@ if which firewall-cmd &>/dev/null; then
firewall-cmd --reload
fi


%preun -n python-%{name}-ovirt
if which firewall-cmd &>/dev/null; then
firewall-cmd --permanent --zone=public --remove-service=ovirtlago
Expand Down
1 change: 1 addition & 0 deletions lago/plugins/vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

from .. import (utils, log_utils, plugins, ssh, )
from lago.config import config

LOGGER = logging.getLogger(__name__)
LogTask = functools.partial(log_utils.LogTask, logger=LOGGER)

Expand Down
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ packages =
ovirtlago
data_files =
# core lago
/etc/lago.d = etc/lago.d/*
/etc/sudoers.d/ = etc/sudo/lago
/etc/polkit-1/localauthority/50-local.d = etc/polkit/*
# ovirt lago plugin
Expand Down

0 comments on commit a771a9d

Please sign in to comment.