Browse Source

[beeswax] Sample user ID

Sample user should have ID of 1100713
Jobsub, Oozie, and Beeswax should create the same sample user.
Abraham Elmahrek 12 years ago
parent
commit
17651b86bc

+ 1 - 2
apps/beeswax/src/beeswax/management/commands/beeswax_install_examples.py

@@ -115,8 +115,7 @@ class Command(NoArgsCommand):
     try:
       user = User.objects.get(username=USERNAME)
     except User.DoesNotExist:
-      user = User(username=USERNAME, password='!', is_active=False, is_superuser=False)
-      user.save()
+      user = User.objects.create(username=USERNAME, password='!', is_active=False, is_superuser=False, id=1100713, pk=1100713)
       LOG.info('Installed a user called "%s"' % (USERNAME,))
     return user
 

+ 4 - 4
apps/jobsub/src/jobsub/management/commands/jobsub_setup.py

@@ -89,13 +89,13 @@ class Command(NoArgsCommand):
 
     if sample_user is None:
       raise Exception(_("Expected sample user fixture."))
+
     # Create the sample user if it doesn't exist
+    USERNAME = 'sample'
     try:
-      sample_user.object = User.objects.get(username=sample_user.object.username)
+      sample_user.object = User.objects.get(username=USERNAME)
     except User.DoesNotExist:
-      sample_user.object.pk = 1100713
-      sample_user.object.id = 1100713
-      sample_user.save()
+      sample_user.object = User.objects.create(username=USERNAME, password='!', is_active=False, is_superuser=False, id=1100713, pk=1100713)
 
     # Create the designs
     for d in sample_oozie_designs:

+ 3 - 2
apps/oozie/src/oozie/management/commands/oozie_setup.py

@@ -55,10 +55,11 @@ class Command(NoArgsCommand):
     fs.do_as_user(fs.DEFAULT_USER, fs.copyFromLocal, local_dir, remote_data_dir)
 
     # Load jobs
+    USERNAME = 'sample'
     try:
-      sample_user = User.objects.get(pk=1100713)
+      sample_user = User.objects.get(username=USERNAME)
     except User.DoesNotExist:
-      sample_user = User.objects.create(username='sample', pk=1100713, id=1100713)
+      sample_user = User.objects.create(username=USERNAME, password='!', is_active=False, is_superuser=False, id=1100713, pk=1100713)
     management.call_command('loaddata', 'initial_oozie_examples.json', verbosity=2)