Bug 246683 - Reimplement ds_create without setuputil code
Reimplement ds_create without setuputil code
Status: CLOSED CURRENTRELEASE
Product: 389
Classification: Community
Component: Admin (Show other bugs)
1.1.0beta
All Linux
low Severity low
: ---
: ---
Assigned To: Rich Megginson
Viktor Ashirov
:
Depends On:
Blocks: 240316 FDS1.1.0
  Show dependency treegraph
 
Reported: 2007-07-03 18:26 EDT by Rich Megginson
Modified: 2015-12-07 11:52 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-12-07 11:52:31 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
new FileConn.pm (10.48 KB, text/plain)
2007-07-03 18:29 EDT, Rich Megginson
no flags Details
ds diffs (19.31 KB, patch)
2007-07-03 18:31 EDT, Rich Megginson
no flags Details | Diff
new ds_create.in (5.68 KB, text/plain)
2007-07-03 18:47 EDT, Rich Megginson
no flags Details
adminserver diffs (33.28 KB, patch)
2007-07-03 18:51 EDT, Rich Megginson
no flags Details | Diff
cvs commit log (Comment #1 and Comment #2) (2.49 KB, text/plain)
2007-07-03 21:29 EDT, Rich Megginson
no flags Details
cvs commit log (Comment #3 and Comment #4) (4.07 KB, text/plain)
2007-07-03 21:32 EDT, Rich Megginson
no flags Details
cvs diff ds_create.in (1.96 KB, patch)
2007-07-10 19:04 EDT, Noriko Hosoi
no flags Details | Diff
cvs diff ds_create.in ds_remove.in (4.51 KB, patch)
2007-07-11 15:06 EDT, Noriko Hosoi
no flags Details | Diff
cvs commit (comment #16) (668 bytes, text/plain)
2007-07-11 17:38 EDT, Noriko Hosoi
no flags Details

  None (edit)
Description Rich Megginson 2007-07-03 18:26:15 EDT
The old ds_create command used to not only create a new ds instance but also
register it with the config ds.
Comment 1 Rich Megginson 2007-07-03 18:29:56 EDT
Created attachment 158484 [details]
new FileConn.pm
Comment 2 Rich Megginson 2007-07-03 18:31:36 EDT
Created attachment 158485 [details]
ds diffs
Comment 3 Rich Megginson 2007-07-03 18:47:31 EDT
Created attachment 158486 [details]
new ds_create.in
Comment 4 Rich Megginson 2007-07-03 18:51:01 EDT
Created attachment 158487 [details]
adminserver diffs
Comment 5 Noriko Hosoi 2007-07-03 19:30:46 EDT
Your implementation looks very cool.
I can borrow a lot for ds_remove.
Comment 6 Noriko Hosoi 2007-07-03 19:32:21 EDT
BTW, I could not find ds_create.res in the attached files.
Comment 7 Rich Megginson 2007-07-03 21:29:23 EDT
Created attachment 158491 [details]
cvs commit log (Comment #1 and Comment #2)

Reviewed by: nhosoi (Thanks!)
Fix Description: ds_create was a CGI program that would create a new instance,
set it up to be managed by console, and register it with the config ds.  The
new ds_create CGI perl script does just that.  One tricky part was that, rather
than enabling the pass through auth plugin and having to restart the server,
the new server is created without being started, then the modification is done
to the new server dse.ldif file directly, using the new FileConn.pm module,
which simulates a Mozilla::LDAP::Conn on an LDIF file.	This also allows us to
create a new instance with a pre-hashed rootdn password, rather than having to
send the cleartext password.
I had to move around some code in AdminServer and AdminUtil so that I could use
it from ds_create.  I also implemented support for the admin server
PASSWORD_PIPE in perl so we could use it in other CGI perl scripts.
Finally, the error handling was not consistent in our code, so I made explicit
the passing of error messages up and down the stack.  Oh how I wish we could
just do this in python and use exception handling . . .
I added a test for ds_create.
Platforms tested: RHEL4
Flag Day: Yes - autotool changes
Doc impact: No.  Should work the same way as the old ds_create.
Comment 8 Rich Megginson 2007-07-03 21:32:51 EDT
Created attachment 158494 [details]
cvs commit log (Comment #3 and Comment #4)

Reviewed by: nhosoi (Thanks!)
Fix Description: ds_create was a CGI program that would create a new instance,
set it up to be managed by console, and register it with the config ds.  The
new ds_create CGI perl script does just that.  One tricky part was that, rather
than enabling the pass through auth plugin and having to restart the server,
the new server is created without being started, then the modification is done
to the new server dse.ldif file directly, using the new FileConn.pm module,
which simulates a Mozilla::LDAP::Conn on an LDIF file.	This also allows us to
create a new instance with a pre-hashed rootdn password, rather than having to
send the cleartext password.
I had to move around some code in AdminServer and AdminUtil so that I could use
it from ds_create.  I also implemented support for the admin server
PASSWORD_PIPE in perl so we could use it in other CGI perl scripts.
Finally, the error handling was not consistent in our code, so I made explicit
the passing of error messages up and down the stack.  Oh how I wish we could
just do this in python and use exception handling . . .
I added a test for ds_create.
Platforms tested: RHEL4
Flag Day: Yes - autotool changes
Doc impact: No.  Should work the same way as the old ds_create.
Comment 9 Rich Megginson 2007-07-03 21:33:49 EDT
(In reply to comment #6)
> BTW, I could not find ds_create.res in the attached files.

Sorry, I didn't attach it - it's currently empty - I just added it as a
placeholder, in case we need to add something in the future.
Comment 10 Noriko Hosoi 2007-07-10 19:04:02 EDT
Created attachment 158914 [details]
cvs diff ds_create.in

File: adminserver/admserv/cgi-src40/ds_create.in

Description: Console expects to receive the CGI output starting from
"Content-type".  Adding the line to the output, I could create new instances
from the Console!!
Comment 11 Rich Megginson 2007-07-10 19:18:54 EDT
It's not really text/html, I guess it's just text/plain.  Otherwise, ok.
Comment 12 Noriko Hosoi 2007-07-10 19:23:31 EDT
Oops. :p  Thanks, Rich.  I'm fixing ds_rewmove.in, too.
Comment 13 Noriko Hosoi 2007-07-10 19:41:06 EDT
(In reply to comment #12)
> Oops. :p  Thanks, Rich.  I'm fixing ds_rewmove.in, too.

Hmmm, an interesting observation...  If I put "text/html", these 2 lines are
displayed on the Status window:

    Creating new server instance...
    The operation was successful.

If I put "text/plain", "The operation was successful" is not displayed even
though it was successful...
Comment 14 Rich Megginson 2007-07-10 21:40:00 EDT
(In reply to comment #13)
> (In reply to comment #12)
> > Oops. :p  Thanks, Rich.  I'm fixing ds_rewmove.in, too.
> 
> Hmmm, an interesting observation...  If I put "text/html", these 2 lines are
> displayed on the Status window:
> 
>     Creating new server instance...
>     The operation was successful.
> 
> If I put "text/plain", "The operation was successful" is not displayed even
> though it was successful...

I guess the console expects text/html . . .
Comment 15 Noriko Hosoi 2007-07-11 15:03:16 EDT
Thank you to Nathan for the detailed investigation on the dialog issue.
Nathan found out httpd requires "Content-type: text/plain\n\n" (note: 2 '\n's).

Regarsing "text/plain" v.s. "text/html", it should have been my test problem.
I cannot reproduce the problem any longer!  So, I'm checking in ds_create.in and
ds_remove.in calling 'print "Content-type: text/plain\n\n";' before each print
out to STDOUT.  I'm attaching the diffs next.
Comment 16 Noriko Hosoi 2007-07-11 15:06:11 EDT
Created attachment 158989 [details]
cvs diff ds_create.in ds_remove.in

Files: adminserver/admserv/cgi-src40/{ds_create.in ds_remove.in}

Description: calling 'print "Content-type: text/plain\n\n";' before each print
out to STDOUT.
Comment 17 Noriko Hosoi 2007-07-11 17:38:23 EDT
Created attachment 159007 [details]
cvs commit (comment #16)

Thank you for your help, Rich and Nathan.

Checked in the diffs into HEAD.
Comment 18 Anh Nguyen 2007-12-11 13:29:44 EST
Tested by console tests. Changed status to verified. 

Note You need to log in before you can comment on or make changes to this bug.