Closed sraustein closed 11 years ago
added new branch tk316 for work on this issue
Trac comment by melkins on 2012-11-09T18:42:48Z
this is just to confuse me :)
Trac comment by randy on 2012-11-10T04:21:46Z
I think I am ready to have you test my changes to allow managing the root handle. In order to do this, there will be some additional steps. Note that some of the command depend on whether your are upgrading your existing database, or starting a new installation from scratch.
[All users] First step is you will need to install Django South. For FreeBSD this is /usr/ports/databases/py-south.
The code is currently in the tk316 branch, so in order to play, you will need to check it out:
{{{
}}}
[Upgrading users] You will need to edit /usr/local/etc/rpki/settings.py and add 'south' to the INSTALLED_APPS list. See /usr/local/etc/rpki/settings.py.new for an example (we don't automatically overwrite settings.py).
[All users] Run syncdb: {{{
}}}
Verify that Django South is installed: {{{
}}}
[Upgrading Users] Since you already have an existing db, you need to fake doing the initial migration step: {{{
}}}
[All users] Perform the database migrations new to this release: {{{
}}}
[All users] Restart apache so that the web portal picks up the newly installed code: {{{
}}}
Now head back to the gui. Click on the 'refresh' link when viewing the altCA dashboard, and it should now pick up the resources from the root cert.
Trac comment by melkins on 2012-11-10T04:26:25Z
On Sat, Nov 10, 2012 at 04:21:46AM -0000, Trac Ticket System wrote:
this is just to confuse me :)
sorry, i was just moving the discussion in #315 about the gui to this ticket because #315 did not start out about the gui, it was about configuring rootd.
Trac comment by melkins on 2012-11-10T04:27:22Z
[Upgrading users] You will need to edit /usr/local/etc/rpki/settings.py and add 'south' to the INSTALLED_APPS list. See /usr/local/etc/rpki/settings.py.new for an example (we don't automatically overwrite settings.py).
[All users] Run syncdb: {{{
django-admin syncdb --pythonpath=/usr/local/etc --settings=settings
}}}
Verify that Django South is installed: {{{
django-admin migrate --list --pythonpath=/usr/local/etc
--settings=settings }}}
ca0.rpki.net:/usr/local/src/net/tk316# cat rpkid/portal-gui/settings.py > /usr/local/etc/rpki/settings.py
ca0.rpki.net:/usr/local/src/net/tk316# cd /usr/local/etc/rpki
ca0.rpki.net:/usr/local/etc/rpki# django-admin.py syncdb --pythonpath=/usr/local/etc --settings=settings
Traceback (most recent call last):
File "/usr/local/bin/django-admin.py", line 5, in
ca0.rpki.net:/usr/local/etc/rpki# django-admin.py syncdb --pythonpath=/usr/local/etc --settings=settings.py
Traceback (most recent call last):
File "/usr/local/bin/django-admin.py", line 5, in
Trac comment by randy on 2012-11-10T05:30:16Z
django-admin syncdb --pythonpath=/usr/local/etc --settings=settings
crap, change all those to /usr/local/etc/rpki
Trac comment by melkins on 2012-11-10T05:39:56Z
ca0.rpki.net:/usr/local/etc/rpki# django-admin.py syncdb --pythonpath=/usr/local/etc/rpki --settings=/usr/local/etc/rpki/settings.py
Traceback (most recent call last):
File "/usr/local/bin/django-admin.py", line 5, in
Trac comment by randy on 2012-11-10T05:50:34Z
On Sat, Nov 10, 2012 at 05:50:34AM -0000, Trac Ticket System wrote:
ca0.rpki.net:/usr/local/etc/rpki# django-admin.py syncdb --pythonpath=/usr/local/etc/rpki --settings=/usr/local/etc/rpki/settings.py
settings is relative to pythonpath:
Trac comment by melkins on 2012-11-10T05:52:25Z
sorry, i had tried that
ca0.rpki.net:/usr/local/etc/rpki# django-admin.py syncdb --pythonpath=/usr/local/etc/rpki --settings=settings.py
Traceback (most recent call last):
File "/usr/local/bin/django-admin.py", line 5, in
Trac comment by randy on 2012-11-10T05:56:50Z
On Sat, Nov 10, 2012 at 05:56:50AM -0000, Trac Ticket System wrote:
ca0.rpki.net:/usr/local/etc/rpki# django-admin.py syncdb --pythonpath=/usr/local/etc/rpki --settings=settings.py
no .py suffix
Trac comment by melkins on 2012-11-10T05:58:05Z
ca0.rpki.net:/usr/local/etc/rpki# django-admin.py syncdb --pythonpath=/usr/local/etc/rpki --settings=settings Error: No module named south
Trac comment by randy on 2012-11-10T06:03:42Z
you missed a step from the instructions:
{{{ [All users] First step is you will need to install Django South. For FreeBSD this is /usr/ports/databases/py-south. }}}
Trac comment by melkins on 2012-11-10T06:09:12Z
aiiiiii
Trac comment by randy on 2012-11-10T06:10:21Z
whew! ok, next step.
Trac comment by randy on 2012-11-10T06:16:53Z
ca0.rpki.net:/usr/local/etc/rpki# django-admin.py syncdb --pythonpath=/usr/local/etc/rpki --settings=settings Syncing... Creating tables ... Creating table south_migrationhistory Installing custom SQL ... Installing indexes ... Installed 0 object(s) from 0 fixture(s)
Synced:
django.contrib.auth django.contrib.contenttypes django.contrib.sessions rpki.irdb rpki.gui.app rpki.gui.cacheview rpki.gui.routeview south
Not synced (use migrations):
(use ./manage.py migrate to migrate these)
ca0.rpki.net:/usr/local/etc/rpki# django-admin.py migrate --list --pythonpath=/usr/local/etc/rpki --settings=settings
ca0.rpki.net:/usr/local/etc/rpki# django-admin.py migrate app 0001 --fake --pythonpath=/usr/local/etc/rpki --settings=settings The app 'app' does not appear to use migrations. ./manage.py migrate [appname] [migrationname|zero] [--all] [--list] [--skip] [--merge] [--no-initial-data] [--fake] [--db-dry-run] [--database=dbalias]
Trac comment by randy on 2012-11-10T06:19:58Z
note that i added a new rpki-manage script which is a wrapper around django-admin so you don't need the --pythonpath= or --settings if you use that
Trac comment by melkins on 2012-11-10T06:27:12Z
ca0.rpki.net:/usr/local/etc/rpki# django-admin.py migrate app 0001 --fake --pythonpath=/usr/local/etc/rpki --settings=settings
app:0001_initial (faked)
ca0.rpki.net:/usr/local/etc/rpki# django-admin.py migrate app --pythonpath=/usr/local/etc/rpki --settings=settings Running migrations for app:
app:0002_auto__add_field_resourcecert_conf app:0003_set_conf_from_parent
app:0004_autochg_field_resourcecert_conf app:0005_autochg_field_resourcecert_parent
apachectl restart
logged into gui fresh
i haz resources!!!
i will do the doc page, cool?
randy
Trac comment by randy on 2012-11-10T06:33:56Z
and will you merge, or sep tree for a while?
Trac comment by randy on 2012-11-10T06:34:24Z
i haz resources!!!
huzzah!
i will do the doc page, cool?
yup.
Trac comment by melkins on 2012-11-10T06:35:36Z
and will you merge, or sep tree for a while?
sep tree until i can get sra to review.
Trac comment by melkins on 2012-11-10T06:36:55Z
i have updated https://trac.rpki.net/wiki/doc/RPKI/CA/UI/GUI
Trac comment by randy on 2012-11-10T06:44:11Z
and will you merge, or sep tree for a while?
sep tree until i can get sra to review.
The parts I understand look reasonable :)
Not sure why you went with a new "conf" field instead of a foreign key to the resource holder, but your code, your call.
I made one stylistic tweak to your change to rpki.irdb.models (my mommy told me never to write "then if" when I could avoid it).
I'd say if you're confident that this code works, go for merge.
Trac comment by sra on 2012-11-10T14:43:21Z
Not sure why you went with a new "conf" field instead of a foreign key to the resource holder, but your code, your call.
implementation detail: Conf is just a proxy model for ResourceHolderCA. All it does is add a few methods I need in my django app.
Trac comment by melkins on 2012-11-10T14:53:19Z
I made one stylistic tweak to your change to rpki.irdb.models (my mommy told me never to write "then if" when I could avoid it).
- if isinstance(kwargs.get("choices"), (tuple, list)) and isinstance(kwargs["choices"][0], str):
- kwargs["choices"] = tuple(enumerate(kwargs["choices"], 1))
i think this is not going to work because if choices is not present, kwargs.get() is going to raise an exception. i sent you a separate email, but South will call the constructor with the 'choices' keyword argument stripped as part of the process of doing db migration. kwargs.get("choices", None) should workd though.
Trac comment by melkins on 2012-11-10T15:00:28Z
- if isinstance(kwargs.get("choices"), (tuple, list)) and isinstance(kwargs["choices"][0], str):
kwargs["choices"] = tuple(enumerate(kwargs["choices"], 1))
i think this is not going to work because if choices is not present, kwargs.get() is going to raise an exception.
Assuming kwargs is a normal Python dict, kwargs.get("foo") returns None if foo is not present.
Trac comment by sra on 2012-11-10T15:14:45Z
In [changeset:4846]: {{{
merge ^/branches/tk316
closes #316 closes #317 }}}
Trac comment by melkins on 2012-11-12T03:13:18Z
Closed with resolution fixed
opening a new ticket for the gui related problem discussed in #315
Trac ticket #316 component gui priority critical, owner melkins, created by melkins on 2012-11-09T18:41:01Z, last modified 2012-11-12T03:13:18Z