forked from openstack/keystone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkeystone-scim.spec
53 lines (46 loc) · 1.66 KB
/
keystone-scim.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
Name: keystone-scim
Version: 0.0.1
Release: 1
Summary: Keystone SCIM extension
License: Copyright 2014 Telefonica Investigación y Desarrollo, S.A.U
Distribution: noarch
Vendor: Telefonica I+D
Group: Applications/System
Packager: Telefonica I+D
Requires: openstack-keystone
autoprov: no
autoreq: no
Prefix: /opt
BuildArch: noarch
%define _target_os Linux
%define python_lib /usr/lib/python2.6/site-packages
%define keystone_paste /usr/share/keystone/keystone-dist-paste.ini
%description
SCIM (System for Cross-domain Identity Management) extension for Keystone
%install
mkdir -p $RPM_BUILD_ROOT/%{python_lib}/keystone/contrib
cp -a %{_root}/keystone/contrib/scim $RPM_BUILD_ROOT/%{python_lib}/keystone/contrib
find $RPM_BUILD_ROOT/%{python_lib}/keystone/contrib -name "*.pyc" -delete
%files
"/usr/lib/python2.6/site-packages/keystone/contrib/scim"
%post
if ! grep -q -F "[filter:scim_extension]" "%{keystone_paste}"; then
echo "Adding SCIM extension to Keystone configuration."
sed -i \
-e '/^\[pipeline:api_v3\]$/,/^\[/ s/^pipeline\(.*\) service_v3$/pipeline\1 scim_extension service_v3/' \
-e 's/\[pipeline:api_v3\]/[filter:scim_extension]\npaste.filter_factory = keystone.contrib.scim.routers:ScimRouter.factory\n\n&/' \
%{keystone_paste}
else
echo "SCIM extension already configured. Skipping."
fi
echo "SCIM extension installed successfully. Restart Keystone daemon to take effect."
%preun
if grep -q -F "[filter:scim_extension]" "%{keystone_paste}"; then
echo "Removing SCIM extension from Keystone configuration."
sed -i \
-e "/\[filter:scim_extension\]/,+2 d" \
-e 's/scim_extension //g' \
%{keystone_paste}
else
echo "SCIM extension not configured. Skipping."
fi