mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-01-12 09:11:55 -06:00
c69d8084c1
This patch contains 2 parts. The first part is a small utility to create and validate the current API. To do this it needs to load ipalib which on a fresh system introduces a few problems, namely that it relies on a python plugin to set the default encoding to utf8. For our purposes we can skip that. It is also important that any optional plugins be loadable so the API can be examined. The second part is a version exchange between the client and server. The version has a major and a minor version. The major verion is updated whenever existing API changes. The minor version is updated when new API is added. A request will be rejected if either the major versions don't match or if the client major version is higher than then server major version (though by implication new API would return a command not found if allowed to proceed). To determine the API version of the server from a client use the ping command. ticket 584
44 lines
1.3 KiB
Python
44 lines
1.3 KiB
Python
# Authors:
|
|
# Rob Crittenden <rcritten@redhat.com>
|
|
#
|
|
# Copyright (C) 2010 Red Hat
|
|
# see file 'COPYING' for use and warranty information
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
"""
|
|
Ping the remote IPA server
|
|
"""
|
|
|
|
from ipalib import api
|
|
from ipalib import Command
|
|
from ipalib import output
|
|
from ipapython.version import VERSION, API_VERSION
|
|
|
|
class ping(Command):
|
|
"""
|
|
ping a remote server
|
|
"""
|
|
has_output = (
|
|
output.summary,
|
|
)
|
|
|
|
def execute(self):
|
|
"""
|
|
A possible enhancement would be to take an argument and echo it
|
|
back but a fixed value works for now.
|
|
"""
|
|
return dict(summary=u'IPA server version %s. API version %s' % (VERSION, API_VERSION))
|
|
|
|
api.register(ping)
|