Bug 246683

Summary: Reimplement ds_create without setuputil code
Product: [Retired] 389 Reporter: Rich Megginson <rmeggins>
Component: AdminAssignee: Rich Megginson <rmeggins>
Status: CLOSED CURRENTRELEASE QA Contact: Viktor Ashirov <vashirov>
Severity: low Docs Contact:
Priority: low    
Version: 1.1.0betaCC: nhosoi, nkinder
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-12-07 16:52:31 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 240316, 427409    
Attachments:
Description Flags
new FileConn.pm
none
ds diffs
none
new ds_create.in
none
adminserver diffs
none
cvs commit log (Comment #1 and Comment #2)
none
cvs commit log (Comment #3 and Comment #4)
none
cvs diff ds_create.in
none
cvs diff ds_create.in ds_remove.in
none
cvs commit (comment #16) none

Description Rich Megginson 2007-07-03 22:26:15 UTC
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 22:29:56 UTC
Created attachment 158484 [details]
new FileConn.pm

Comment 2 Rich Megginson 2007-07-03 22:31:36 UTC
Created attachment 158485 [details]
ds diffs

Comment 3 Rich Megginson 2007-07-03 22:47:31 UTC
Created attachment 158486 [details]
new ds_create.in

Comment 4 Rich Megginson 2007-07-03 22:51:01 UTC
Created attachment 158487 [details]
adminserver diffs

Comment 5 Noriko Hosoi 2007-07-03 23:30:46 UTC
Your implementation looks very cool.
I can borrow a lot for ds_remove.

Comment 6 Noriko Hosoi 2007-07-03 23:32:21 UTC
BTW, I could not find ds_create.res in the attached files.

Comment 7 Rich Megginson 2007-07-04 01:29:23 UTC
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-04 01:32:51 UTC
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-04 01:33:49 UTC
(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 23:04:02 UTC
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 23:18:54 UTC
It's not really text/html, I guess it's just text/plain.  Otherwise, ok.

Comment 12 Noriko Hosoi 2007-07-10 23:23:31 UTC
Oops. :p  Thanks, Rich.  I'm fixing ds_rewmove.in, too.

Comment 13 Noriko Hosoi 2007-07-10 23:41:06 UTC
(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-11 01:40:00 UTC
(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 19:03:16 UTC
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 19:06:11 UTC
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 21:38:23 UTC
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 18:29:44 UTC
Tested by console tests. Changed status to verified.