mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Add local-dist target.
Remove hard-coded config.
This commit is contained in:
19
Makefile
19
Makefile
@@ -53,10 +53,20 @@ version-update:
|
||||
> ipa-python/freeipa-python.spec
|
||||
|
||||
|
||||
tarballs:
|
||||
archive:
|
||||
-mkdir -p dist
|
||||
hg archive -t files dist/freeipa
|
||||
|
||||
local-archive:
|
||||
-mkdir -p dist/freeipa
|
||||
@for subdir in $(SUBDIRS); do \
|
||||
cp -pr $$subdir dist/freeipa/.; \
|
||||
done
|
||||
|
||||
archive-cleanup:
|
||||
rm -fr dist/freeipa
|
||||
|
||||
tarballs:
|
||||
# ipa-server
|
||||
mv dist/freeipa/ipa-server dist/$(SERV_TARBALL_PREFIX)
|
||||
rm -f dist/$(SERV_TARBALL)
|
||||
@@ -75,9 +85,6 @@ tarballs:
|
||||
cd dist; tar cfz $(PYTHON_TARBALL) $(PYTHON_TARBALL_PREFIX)
|
||||
rm -fr dist/$(PYTHON_TARBALL_PREFIX)
|
||||
|
||||
# cleanup
|
||||
rm -fr dist/freeipa
|
||||
|
||||
rpm-ipa-server:
|
||||
cp dist/$(SERV_TARBALL) ~/rpmbuild/SOURCES/.
|
||||
rpmbuild -ba ipa-server/freeipa-server.spec
|
||||
@@ -98,7 +105,9 @@ rpm-ipa-python:
|
||||
|
||||
rpms: rpm-ipa-server rpm-ipa-admin rpm-ipa-python
|
||||
|
||||
dist: version-update tarballs rpms
|
||||
dist: version-update archive tarballs archive-cleanup rpms
|
||||
|
||||
local-dist: clean version-update local-archive tarballs archive-cleanup rpms
|
||||
|
||||
dist-clean: clean
|
||||
rm -fr dist
|
||||
|
||||
@@ -22,6 +22,8 @@ import sys
|
||||
from optparse import OptionParser
|
||||
import ipa
|
||||
import ipa.rpcclient
|
||||
import ipa.config
|
||||
|
||||
import xmlrpclib
|
||||
|
||||
def usage():
|
||||
@@ -43,7 +45,8 @@ def parse_options():
|
||||
parser.add_option("--usage", action="store_true",
|
||||
help="Program usage")
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
args = ipa.config.init_config(sys.argv)
|
||||
options, args = parser.parse_args(args)
|
||||
|
||||
if not options.gn or not options.sn:
|
||||
usage()
|
||||
@@ -52,14 +55,14 @@ def parse_options():
|
||||
|
||||
def main():
|
||||
user={}
|
||||
(options, args) = parse_options()
|
||||
options, args = parse_options()
|
||||
|
||||
if len(args) != 1:
|
||||
if len(args) != 2:
|
||||
usage()
|
||||
|
||||
user['gn'] = options.gn
|
||||
user['sn'] = options.sn
|
||||
user['uid'] = args[0]
|
||||
user['uid'] = args[1]
|
||||
if options.gecos:
|
||||
user['gecos'] = options.gecos
|
||||
if options.directory:
|
||||
|
||||
@@ -18,9 +18,12 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
import sys
|
||||
from optparse import OptionParser
|
||||
import ipa
|
||||
import ipa.rpcclient
|
||||
import ipa.config
|
||||
|
||||
import base64
|
||||
import sys
|
||||
import xmlrpclib
|
||||
@@ -32,19 +35,20 @@ def usage():
|
||||
def parse_options():
|
||||
parser = OptionParser()
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
args = ipa.config.init_config(sys.argv)
|
||||
options, args = parser.parse_args(args)
|
||||
|
||||
return options, args
|
||||
|
||||
def main():
|
||||
user={}
|
||||
(options, args) = parse_options()
|
||||
options, args = parse_options()
|
||||
|
||||
if len(args) != 1:
|
||||
if len(args) != 2:
|
||||
usage()
|
||||
|
||||
try:
|
||||
ent = ipa.rpcclient.get_user(args[0])
|
||||
ent = ipa.rpcclient.get_user(args[1])
|
||||
for name, value in ent.items():
|
||||
if isinstance(value, str):
|
||||
print name + ": " + value
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
PYTHONLIBDIR ?= $(shell python -c "from distutils.sysconfig import *; print get_python_lib(1)")
|
||||
PACKAGEDIR ?= $(DESTDIR)/$(PYTHONLIBDIR)/ipa
|
||||
CONFIGDIR ?= $(DESTDIR)/etc/ipa
|
||||
|
||||
all: ;
|
||||
|
||||
install:
|
||||
-mkdir -p $(PACKAGEDIR)
|
||||
install -m 644 *.py $(PACKAGEDIR)
|
||||
-mkdir -p $(CONFIGDIR)
|
||||
install -m 644 ipa.conf $(CONFIGDIR)
|
||||
|
||||
clean:
|
||||
rm -f *~ *.pyc
|
||||
@@ -15,6 +15,7 @@ Requires: python
|
||||
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
|
||||
|
||||
%define pkgpythondir %{python_sitelib}/ipa
|
||||
%define configdir /etc/ipa
|
||||
|
||||
%description
|
||||
FreeIPA is a server for identity, policy, and audit.
|
||||
@@ -25,6 +26,7 @@ FreeIPA is a server for identity, policy, and audit.
|
||||
%install
|
||||
rm -rf %{buildroot}
|
||||
mkdir -p %{buildroot}%{pkgpythondir}
|
||||
mkdir -p %{buildroot}%{configdir}
|
||||
|
||||
make install DESTDIR=%{buildroot}
|
||||
|
||||
@@ -36,6 +38,7 @@ rm -rf %{buildroot}
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%{pkgpythondir}/*
|
||||
%config(noreplace) %{configdir}/ipa.conf
|
||||
|
||||
|
||||
%changelog
|
||||
|
||||
@@ -15,6 +15,7 @@ Requires: python
|
||||
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
|
||||
|
||||
%define pkgpythondir %{python_sitelib}/ipa
|
||||
%define configdir /etc/ipa
|
||||
|
||||
%description
|
||||
FreeIPA is a server for identity, policy, and audit.
|
||||
@@ -25,6 +26,7 @@ FreeIPA is a server for identity, policy, and audit.
|
||||
%install
|
||||
rm -rf %{buildroot}
|
||||
mkdir -p %{buildroot}%{pkgpythondir}
|
||||
mkdir -p %{buildroot}%{configdir}
|
||||
|
||||
make install DESTDIR=%{buildroot}
|
||||
|
||||
@@ -36,6 +38,7 @@ rm -rf %{buildroot}
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%{pkgpythondir}/*
|
||||
%config(noreplace) %{configdir}/ipa.conf
|
||||
|
||||
|
||||
%changelog
|
||||
|
||||
@@ -26,18 +26,25 @@ except ImportError:
|
||||
pass
|
||||
import xmlrpclib
|
||||
import socket
|
||||
import os
|
||||
import base64
|
||||
import config
|
||||
|
||||
# Some errors to catch
|
||||
# http://cvs.fedora.redhat.com/viewcvs/ldapserver/ldap/servers/plugins/pam_passthru/README?root=dirsec&rev=1.6&view=auto
|
||||
|
||||
def server_url():
|
||||
return "http://" + config.config.get_server() + "/ipa"
|
||||
|
||||
# FIXME: do we want this set somewhere else?
|
||||
server = xmlrpclib.ServerProxy("http://localhost:80/ipa")
|
||||
server = None
|
||||
|
||||
def setup_server():
|
||||
global server
|
||||
if not server:
|
||||
server = xmlrpclib.ServerProxy(server_url())
|
||||
|
||||
def get_user(username):
|
||||
"""Get a specific user"""
|
||||
|
||||
setup_server()
|
||||
try:
|
||||
result = server.get_user(username)
|
||||
myuser = result
|
||||
@@ -52,9 +59,10 @@ def get_user(username):
|
||||
|
||||
def add_user(user):
|
||||
"""Add a new user"""
|
||||
setup_server()
|
||||
|
||||
# FIXME: Get the realm from somewhere
|
||||
realm="GREYOAK.COM"
|
||||
realm = config.config.get_realm()
|
||||
|
||||
# FIXME: This should be dynamic and can include just about anything
|
||||
# Let us add in some missing attributes
|
||||
@@ -87,13 +95,14 @@ def get_add_schema():
|
||||
"""Get the list of attributes we need to ask when adding a new
|
||||
user.
|
||||
"""
|
||||
setup_server()
|
||||
|
||||
# FIXME: Hardcoded and designed for the TurboGears GUI. Do we want
|
||||
# this for the CLI as well?
|
||||
try:
|
||||
result = server.get_add_schema()
|
||||
except xmlrpclib.Fault, fault:
|
||||
raise xmlrpclib.Fault(fault,faultCode, fault.faultString)
|
||||
raise xmlrpclib.Fault(fault, fault.faultString)
|
||||
return None
|
||||
except socket.error, (value, msg):
|
||||
raise xmlrpclib.Fault(value, msg)
|
||||
|
||||
@@ -119,6 +119,13 @@ def main():
|
||||
# Restart apache
|
||||
run(["/sbin/service", "httpd", "restart"])
|
||||
|
||||
# Create the config file
|
||||
fd = open("/etc/ipa/ipa.conf", "w")
|
||||
fd.write("[defaults]\n")
|
||||
fd.write("server=" + host_name + "\n")
|
||||
fd.write("realm=" + options.realm_name + "\n")
|
||||
fd.close()
|
||||
|
||||
return 0
|
||||
|
||||
main()
|
||||
|
||||
@@ -23,10 +23,12 @@ sys.path.append("/usr/share/ipa")
|
||||
import ldap
|
||||
import ipaserver.dsinstance
|
||||
import ipaserver.ipaldap
|
||||
import ipaserver.util
|
||||
import pdb
|
||||
import string
|
||||
from types import *
|
||||
import xmlrpclib
|
||||
import ipa.config
|
||||
|
||||
# FIXME, this needs to be auto-discovered
|
||||
host = 'localhost'
|
||||
@@ -34,7 +36,10 @@ port = 389
|
||||
binddn = "cn=directory manager"
|
||||
bindpw = "freeipa"
|
||||
|
||||
basedn = "dc=greyoak,dc=com"
|
||||
ipa.config.init_config()
|
||||
basedn = ipaserver.util.realm_to_suffix(ipa.config.config.get_realm())
|
||||
import sys
|
||||
sys.stderr.write(basedn)
|
||||
scope = ldap.SCOPE_SUBTREE
|
||||
|
||||
def get_user (username):
|
||||
@@ -85,7 +90,7 @@ def get_user (username):
|
||||
|
||||
def add_user (user):
|
||||
"""Add a user in LDAP"""
|
||||
dn="uid=%s,ou=users,ou=default,dc=greyoak,dc=com" % user['uid']
|
||||
dn="uid=%s,ou=users,ou=default,%s" % (user['uid'], basedn)
|
||||
entry = ipaserver.ipaldap.Entry(dn)
|
||||
|
||||
# some required objectclasses
|
||||
|
||||
Reference in New Issue
Block a user