Re: Scripting thn_register

Hunter Matthews <[email protected]>
Newsgroups gmane.network.up2date.current.devel
Message-ID <[email protected]>
Mondays.



On Mon, 2002-07-29 at 10:53, Hunter Matthews wrote:
> With the standard rhnreg_ks,
> rhnreg_ks --username=x --password=x --email=x --nohardware --nopackages
> 
> should do the trick (it works here)
> 
> If you want to patch the client (which current hasn't done as of yet,
> officially)
> 
> you can try the accompanied patch (which also works here).
> The patch is against rhn_register-2.7.2, which is out of date, but it
> works fine, and it should be easy to forward patch.
> 
> 
> 
> On Mon, 2002-07-29 at 06:34, Michael Redinger wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> > 
> > 
> > Didn't try this, but it should work ...
> > 
> > - - set the server in the config files
> > - - man rhnreg_ks
> > 
> > Michael
> > 
> > On 29 Jul 2002, John Hearns wrote:
> > 
> > > Has anyone had much success with scripting rhn_register?
> > > 
> > > I would like to run rhn_register automatically as a post-install 
> > > step. We would liek to automate installs as much as possible,
> > > and running rhn_register is not feasible.
> > > 
> > > 
> > > This won't work for me:
> > > rhn_register --nox --configure \ serverURL=https://server:8081/XMLRPC
> > > 
> > > I could use Expect to script it I suppose.
> > > 
> > > Another way of doing things is just to supply a
> > > /etc/sysconfig/rhn/rhn_register and systemid  pre-configured as part of
> > > an RPM at install time.
> > > That sounds ok - but all systems will then have the same systemid.
> > > Maybe will cause problems in the future?
> > 
> > 
> > 
> > 
> > 
> > - --------------------------------------------------------------------
> > Michael Redinger
> > Zentraler Informatikdienst	
> > Universitaet Innsbruck		
> > Technikerstr. 13		Tel.:   +43 512 507 2335
> > A-6020 INNSBRUCK		Fax.:   +43 512 507 2944
> > Austria				E-Mail: [email protected]
> > - --------------------------------------------------------------------
> > 
> > "One ping to rule them all,
> >  One ping to find them,
> >  One ping to bring them all,
> >  and in the darkness bind them."
> > 
> > 
> > -----BEGIN PGP SIGNATURE-----
> > Version: PGP 6.5.8
> > 
> > iQA/AwUBPUUaOA/XqdllwsEdEQLXigCcCH9pca2u2q1iaCr79Fhdm1fRjbgAoI2Y
> > NVO6c14fURzNuKT3c5KlayUs
> > =0Swk
> > -----END PGP SIGNATURE-----
> > 
> > 
> > _______________________________________________
> > Current-server mailing list
> > [email protected]
> > http://lists.dulug.duke.edu/mailman/listinfo/current-server
> > 
> > 
> -- 
> Hunter Matthews                          Unix / Network Administrator
> Office: BioScience 145/244               Duke Univ. Biology Department
> Key: F0F88438 / FFB5 34C0 B350 99A4 BB02  9779 A5DB 8B09 F0F8 8438
> Never take candy from strangers. Especially on the internet.
> 
> _______________________________________________
> Current-server mailing list
> [email protected]
> http://lists.dulug.duke.edu/mailman/listinfo/current-server
> 
> 
-- 
Hunter Matthews                          Unix / Network Administrator
Office: BioScience 145/244               Duke Univ. Biology Department
Key: F0F88438 / FFB5 34C0 B350 99A4 BB02  9779 A5DB 8B09 F0F8 8438
Never take candy from strangers. Especially on the internet.
rhnanon.patch (text/plain, 1.7 KB)
--- rhnreg_ks.py	Fri Apr 12 15:59:45 2002
+++ /home/thm/rhnreg_ks	Wed May 29 16:54:55 2002
@@ -46,6 +46,7 @@
     print _("    --nopackages               - do not profile or upload any package info ")
     print _("    --force                    - register the system even if it is already registered")
     print _("    --version                  - display the version ")
+    print _("    --anon                     - do anonymous registration ")
     print ""
 
 
@@ -133,7 +134,7 @@
                                        'nohardware',
                                        'serialnumber=',
                                        'contactinfo',
-                                       'email=',"force",])
+                                       'email=',"force",'anon',])
     except getopt.error, e:
         print _("Error parsing command list arguments: %s") % e
         printUseage()
@@ -177,6 +178,8 @@
             serialnumber = str(opt[1])
         if opt[0] == "--contactinfo":
             contactinfo = readContactInfo()
+	if opt[0] == "--anon":
+            anon_reg = 1
         if opt[0] == "--version":
             showVersion()
             sys.exit(-1)
@@ -186,6 +189,16 @@
         print _("This system is already registered. Use --force to override")
         sys.exit(-1)
 
+    if anon_reg:
+	username = "Anonymous"
+	password = "Anonymous"
+        if not profilename:
+            profilename = "Anonymous Profile"
+        systemId = rhnreg.registerSystem(username, password, profilename)
+        # write out the new id
+        rhnreg.writeSystemId(systemId)
+	return
+
     if not username or not password and not email:
         print _("A username,password,and email address are required to register a system.")
         sys.exit(-1)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.