Patch 21:
Update per recommendation

Patch 22:
Added version option as well as updated the manpage.

Thanks,

Gabe


On Fri, Jun 6, 2014 at 5:47 AM, Petr Viktorin <pvikt...@redhat.com> wrote:

> On 06/06/2014 08:36 AM, Gabe Alford wrote:
>
>> Hello,
>>
>> Patch 21:
>> This is a patch for https://fedorahosted.org/freeipa/ticket/3724
>>
>
> Nope, doesn't work for me: nolog_replace expects a string.
>
>  File "/usr/lib/python2.7/site-packages/ipaserver/install/installutils.py",
> line 639, in run_script
>     return_value = main_function()
>   File "/usr/sbin/ipa-upgradeconfig", line 1140, in main
>     certificate_renewal_update(ca),
>   File "/usr/sbin/ipa-upgradeconfig", line 691, in
> certificate_renewal_update
>     ca.configure_renewal()
>   File "/usr/lib/python2.7/site-packages/ipaserver/install/cainstance.py",
> line 1444, in configure_renewal
>     post_command='renew_ca_cert "%s"' % nickname)
>   File "/usr/lib/python2.7/site-packages/ipapython/certmonger.py", line
> 431, in dogtag_start_tracking
>     (stdout, stderr, returncode) = ipautil.run(args, nolog=[pin])
>   File "/usr/lib/python2.7/site-packages/ipapython/ipautil.py", line 305,
> in run
>     arg_string = nolog_replace(args, nolog)
>   File "/usr/lib/python2.7/site-packages/ipapython/ipautil.py", line 360,
> in nolog_replace
>     string = string.replace(nolog_value, 'XXXXXXXX')
>
>
> I'd recommend something like ' '.join(shell_quote(a) for a in args).
>
>
>  Patch 22:
>> This is part of https://fedorahosted.org/freeipa/ticket/4316 and adds
>> the API to 'ipa env'
>>
>> One question that I had for adding 'ipa --version' is if using the
>> default optparse version argument would be sufficient/intended i.e.
>> version=('Version: %s, API_Version: %s' % (version, api_version) or if a
>> custom optparse argument is needed.
>>
>
> I think the default will be just fine. Can you update the patch to add the
> option?
>
> --
> Petrł
>
>
From e1fccecb68b946b1868255b1db7ed3227c24ccdc Mon Sep 17 00:00:00 2001
From: Gabe <redhatri...@gmail.com>
Date: Fri, 6 Jun 2014 06:39:59 -0600
Subject: [PATCH] Add version and API version

- Add API version to constants.py
- Add version option to plugable.py
- Add version to ipa manpage and fix a couple of typos

https://fedorahosted.org/freeipa/ticket/4316
---
 ipa.1               |    6 ++++--
 ipalib/constants.py |    4 +++-
 ipalib/plugable.py  |    3 +++
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/ipa.1 b/ipa.1
index 3d998cc1bb1053b079fa3813a037f7a09926a1bd..fc39fceaae5aa4c614ccaaa7e608f2326d926755 100644
--- a/ipa.1
+++ b/ipa.1
@@ -37,7 +37,7 @@ Load configuration from \fIFILE\fR.
 \fB\-d\fR, \fB\-\-debug\fR
 Produce full debugging output.
 .TP
-\fB\-\-\-delegate\fR
+\fB\-\-delegate\fR
 Delegate the user's TGT to the IPA server
 .TP
 \fB\-e\fR \fIKEY=VAL\fR
@@ -56,7 +56,9 @@ Prompt for all parameters of \fICOMMAND\fR, even if they are optional.
 Don't fall back to other IPA servers if the default doesn't work.
 .TP
 \fB\-v\fR, \fB\-\-verbose\fR
-Produce verbose output. A second \-v displays the XML\-RPC request
+Produce verbose output. A second \-v displays the XML\-RPC request.
+\fB\-\-version\fR
+Display the IPA version and API version.
 .SH "COMMANDS"
 The principal function of the CLI is to execute administrative commands specified by the \fICOMMAND\fR argument. The majority of commands are executed remotely over XML\-RPC on a IPA server listed in the configuration file (see FILES section of this manual page).
 
diff --git a/ipalib/constants.py b/ipalib/constants.py
index e98eee6f8bcf2c227daa88327326b4dd850fbfe0..2269189f443844f77f3d8499cda3b88ae6d1d760 100644
--- a/ipalib/constants.py
+++ b/ipalib/constants.py
@@ -23,7 +23,8 @@ All constants centralised in one file.
 """
 import socket
 from ipapython.dn import DN
-from ipapython.version import VERSION
+from ipapython.version import VERSION, API_VERSION
+
 try:
     FQDN = socket.getfqdn()
 except:
@@ -65,6 +66,7 @@ CONFIG_SECTION = 'global'
 # This is a tuple instead of a dict so that it is immutable.
 # To create a dict with this config, just "d = dict(DEFAULT_CONFIG)".
 DEFAULT_CONFIG = (
+    ('api_version', API_VERSION),
     ('version', VERSION),
 
     # Domain, realm, basedn:
diff --git a/ipalib/plugable.py b/ipalib/plugable.py
index 216f9c08a8b5d22bdb1e7853013967e8fe3f88b0..a6504d16222ff9c714a17e71db3d8bd12d885a9b 100644
--- a/ipalib/plugable.py
+++ b/ipalib/plugable.py
@@ -43,6 +43,7 @@ from text import _
 from base import ReadOnly, NameSpace, lock, islocked, check_name
 from constants import DEFAULT_CONFIG
 from ipapython.ipa_log_manager import *
+from ipapython.version import VERSION, API_VERSION
 
 # FIXME: Updated constants.TYPE_ERROR to use this clearer format from wehjit:
 TYPE_ERROR = '%s: need a %r; got a %r: %r'
@@ -559,6 +560,8 @@ class API(DictProxy):
                 formatter=IPAHelpFormatter(),
                 usage='%prog [global-options] COMMAND [command-options]',
                 description='Manage an IPA domain',
+                version=('VERSION: %s, API_VERSION: %s'
+                                % (VERSION, API_VERSION)),
                 epilog='\n'.join([
                     'See "ipa help topics" for available help topics.',
                     'See "ipa help <TOPIC>" for more information on a '
-- 
1.7.1

From ea6ec719dc3407170399e1727869e2a599ba065e Mon Sep 17 00:00:00 2001
From: Gabe <redhatri...@gmail.com>
Date: Fri, 6 Jun 2014 06:55:23 -0600
Subject: [PATCH] ipautil.run args log message is confusing

https://fedorahosted.org/freeipa/ticket/3724
---
 ipapython/ipautil.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ipapython/ipautil.py b/ipapython/ipautil.py
index ce4c978385ba681d2925dfd4816cb1f334d3a1c2..844dbb68792c483552149be7ae442a1e40eb9626 100644
--- a/ipapython/ipautil.py
+++ b/ipapython/ipautil.py
@@ -301,7 +301,7 @@ def run(args, stdin=None, raiseonerr=True,
         p_out = subprocess.PIPE
         p_err = subprocess.PIPE
 
-    arg_string = nolog_replace(' '.join(args), nolog)
+    arg_string = nolog_replace(' '.join(shell_quote(a) for a in args), nolog)
     root_logger.debug('Starting external process')
     root_logger.debug('args=%s' % arg_string)
 
-- 
1.7.1

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to