Merge lp:~rvb/maas/maas-bug-955451 into lp:~maas-committers/maas/trunk

Proposed by Raphaël Badin
Status: Merged
Approved by: Raphaël Badin
Approved revision: no longer in the source branch.
Merged at revision: 293
Proposed branch: lp:~rvb/maas/maas-bug-955451
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 59 lines (+5/-11)
2 files modified
src/maasserver/models.py (+2/-2)
src/maasserver/tests/test_models.py (+3/-9)
To merge this branch: bzr merge lp:~rvb/maas/maas-bug-955451
Reviewer Review Type Date Requested Status
Gavin Panella (community) Approve
Review via email: mp+97694@code.launchpad.net

Commit message

Change default maas_name.

Description of the change

This branch fixes the default maas_name config to use the hostname. This way, the displayed name will be "hostname MAAS".

To post a comment you must log in.
Revision history for this message
Gavin Panella (allenap) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/maasserver/models.py'
2--- src/maasserver/models.py 2012-03-14 15:40:45 +0000
3+++ src/maasserver/models.py 2012-03-15 16:23:35 +0000
4@@ -25,10 +25,10 @@
5 import copy
6 import datetime
7 from errno import ENOENT
8-import getpass
9 from logging import getLogger
10 import os
11 import re
12+from socket import gethostname
13 import time
14 from uuid import uuid1
15
16@@ -761,7 +761,7 @@
17 'update_from_choice': (
18 [['archive.ubuntu.com', 'archive.ubuntu.com']]),
19 # Network section configuration.
20- 'maas_name': "%s's" % getpass.getuser().capitalize(),
21+ 'maas_name': gethostname(),
22 'provide_dhcp': False,
23 ## /settings
24 }
25
26=== modified file 'src/maasserver/tests/test_models.py'
27--- src/maasserver/tests/test_models.py 2012-03-13 10:41:00 +0000
28+++ src/maasserver/tests/test_models.py 2012-03-15 16:23:35 +0000
29@@ -15,14 +15,12 @@
30 from io import BytesIO
31 import os
32 import shutil
33+from socket import gethostname
34
35 from django.conf import settings
36 from django.contrib.auth.models import User
37 from django.core.exceptions import ValidationError
38-from fixtures import (
39- EnvironmentVariableFixture,
40- TestWithFixtures,
41- )
42+from fixtures import TestWithFixtures
43 from maasserver.exceptions import (
44 CannotDeleteUserException,
45 PermissionDenied,
46@@ -697,12 +695,8 @@
47 """Test config default values."""
48
49 def test_default_config_maas_name(self):
50- name = factory.getRandomString()
51- fixture = EnvironmentVariableFixture('LOGNAME', name)
52- self.useFixture(fixture)
53 default_config = get_default_config()
54- self.assertEqual(
55- "%s's" % name.capitalize(), default_config['maas_name'])
56+ self.assertEqual(gethostname(), default_config['maas_name'])
57
58
59 class Listener: