mirror of
https://github.com/PowerDNS-Admin/PowerDNS-Admin.git
synced 2026-04-25 08:45:55 +03:00
[GH-ISSUE #61] Allow dyndns to create host record if it doesn't exist #40
Labels
No labels
bug / broken-feature
bug / broken-feature
docs / request
feature / request
help / other
mod / help-wanted
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/PowerDNS-Admin-PowerDNS-Admin#40
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @trenb on GitHub (Jul 1, 2016).
Original GitHub issue: https://github.com/PowerDNS-Admin/PowerDNS-Admin/issues/61
Originally assigned to: @ivanfilippov on GitHub.
Would it be possible to allow host records to be created via dyndns if they don't exist, but so long as the user has rights to the domain?
@ivanfilippov commented on GitHub (Jul 1, 2016):
I like this idea in, but I'd like for it to be a setting, on a per domain basis. We don't have a way of setting per-domain settings yet but probably should look for into creating one.
@ngoduykhanh what do you think?
@trenb commented on GitHub (Jul 1, 2016):
Agreed. For us it allows newly provisioned hosts to be added to DNS as soon as they're turned up as we include ddclient as a standard part of our provisioning.
@ngoduykhanh commented on GitHub (Jul 2, 2016):
There is no public dyndns service provider allow to do this. Because of security and records management. But in internal use, in one of server provisioing step, using ddclient to provision the host's domain name is a really good idea.
I agree with you @ivanfilippov, this should be a setting. By default we won't allow this, but we can have a setting to "turn it on" for specific domains.
@ivanfilippov commented on GitHub (Jul 2, 2016):
I have an implementation of domain specific settings almost ready with this
dyndns feature as the first use case. I'll submit it for review in the next
day or so.
On Jul 1, 2016 10:16 PM, "Khanh Ngo" notifications@github.com wrote:
@ivanfilippov commented on GitHub (Jul 2, 2016):
Hi @ngoduykhanh
Please review this new branch: https://github.com/ivanfilippov/PowerDNS-Admin/tree/per_domain_settings
If you don't see see any issues I'll submit a PR.
@trenb you're welcome to try that branch as well. 😄
You'll need to do a DB migrate/upgrade if you're not doing a fresh install.
@ivanfilippov commented on GitHub (Jul 2, 2016):
@ngoduykhanh
I'm waiting for user testing on branch
scriptroot_fixfrom #52, there is one place in the newper_domain_settingsbranch that will need the scriptroot_fix as well. Can you help test thescriptroot_fixbranch? If it looks good I'll PR that and then update theper_domain_settingsbranch.@trenb commented on GitHub (Jul 2, 2016):
I get an error from both db_migrate.py and db_upgrade.py. They both complain about:
Which there is no directory for that. Am I missing files from this branch? Also, where are the settings for enabling this feature? The settings screen is the same as it was before. And if I try to admin a domain, everything blows up, assuming because I'm not running the correct DB version.
Looking forward to trying this feature out! Thanks for your hard work!
@ngoduykhanh commented on GitHub (Jul 2, 2016):
Thanks @ivanfilippov for the quick implementation. I've tried your code but it doesn't work. There 2 issues I can see now are:
@trenb : The
db_repositorydirectory was created when you runcreate_db.py. I think you missed this directory somehow when clone the repository to new place and reuse the old database.@trenb commented on GitHub (Jul 2, 2016):
@ngoduykhanh Aww. That original directory is long since gone. Is there a way to regenerate it?
@trenb commented on GitHub (Jul 3, 2016):
@ngoduykhanh Ah well, I flattened my install and started fresh. I'll ensure I keep that db_repository directory, though it doesn't seem to actually be filled with anything other than empty py files.
@ivanfilippov The feature is tested and it does add the record. However it's marked as "disabled". Is this expected?
Thank you for your work! Let me know if you need any other information.
@ivanfilippov commented on GitHub (Jul 3, 2016):
@trenb You're right about the disabled thing. I've fixed that in the latest commit to that branch.
@ngoduykhanh I can't seem to replicate the checkbox issue on my side. When I check it, the browser does the javascript call and the checkbox stays checked after it succeeds. I'll keep trying to replicate but I'm probably missing something.
Also, for your comment in the code the
DomainSetting.domainis actually a reference to aDomainobject (via a relationship in the model) instead of just the domain name. It's working for me but did your fix solve an issue?@trenb commented on GitHub (Jul 3, 2016):
@ivanfilippov I've got that, tested and working perfectly now. Thank you!
@ngoduykhanh commented on GitHub (Jul 3, 2016):
@ivanfilippov
I see. I've tried again. The exception which I got is:
Looking to the DB I see:
It means that
ondemand_creation.valueis a string with valuetrueand cannot be parsed into integer. But why the value istrueinstead of1or0? I realize that the new_value which theviewget from the browser isTrue(bool type).Depends on the DB backend, It is difference between MySQL and Postgresql
That's the reason why I got the exception :D. I think you better to set the value of settings in
domain_settingto (TrueorFalse) instead of (1or0). Just likes what we did in thesettingtable@ivanfilippov commented on GitHub (Jul 3, 2016):
Good call, I'm using MySQL, I'll make the change to put in True instead of
the integer.
Ivan Filippov
On Jul 2, 2016 21:33, "Khanh Ngo" notifications@github.com wrote:
@ivanfilippov commented on GitHub (Jul 3, 2016):
I think I've got it, check this commit
github.com/ivanfilippov/PowerDNS-Admin@b096788cf1It now stores the string representation of
TrueandFalseand still works fine in MySQL. @ngoduykhanh can you try with pgSQL (I don't have a pgSQL environment ready)?@ngoduykhanh commented on GitHub (Jul 3, 2016):
I have test with my Postgresql env, it works fine if the setting is preset. Just 2 more small adjustment need to be done. I've commented in your code. Thanks @ivanfilippov
@ivanfilippov commented on GitHub (Jul 3, 2016):
Thanks for the comments! Try
github.com/ivanfilippov/PowerDNS-Admin@e0461a5210and let me know what you think.@ngoduykhanh commented on GitHub (Jul 4, 2016):
It looks like you missed one of my comments. The last one is about the checkbox's value after changing from integers to True/False string. See comment. I think you can create the PR after that. Thanks.
@ivanfilippov commented on GitHub (Jul 6, 2016):
Fixed and PR submitted.
Thanks for all your help @ngoduykhanh 😄
@ngoduykhanh commented on GitHub (Jul 6, 2016):
Merged. Thanks @ivanfilippov
@joachimtingvold commented on GitHub (Jul 6, 2016):
create_db.py needs an update for this too? On a general note; how to address database changes for existing users? db_upgrade.py only handles the actually upgrade of version/whatnot, and does not address new/updates schemas?
@joachimtingvold commented on GitHub (Jul 6, 2016):
Would be nice to add some
CREATE TABLEstuff for this change as well, so we don't have to reverse-engineer what types of columns/whatnot (-:@joachimtingvold commented on GitHub (Jul 6, 2016):
And yes, the above commit/merge broke the Admin-page for those of us without the table (-:
@joachimtingvold commented on GitHub (Jul 13, 2016):
@ivanfilippov, could you provide the
CREATE TABLEfor this one?@joachimtingvold commented on GitHub (Jul 13, 2016):
I guess roughly something like this;
@ivanfilippov commented on GitHub (Jul 13, 2016):
@jallakim You can use
db_migrate.pyto generate the code that reflects the schema changes that happen between versions (they get put into the db_repository directory) anddb_upgrade.pyto apply the changes . You can run both every time you upgrade your PDNS-Admin repo to keep up to date, that won't break anything.create_db.pyshouldn't need to get upgraded because it's meant to to be used during a new install and it will create the database based on the current models defined inmodels.py😄Sorry for the delay in response, we don't get notified about comments on closed issues and I only saw your recent comments because you mentioned my username directly.
Here is the schema that is currently in my database (I'm using MariaDB, MySQL should be identical, will need some modifications for SQLite and PGsql):
@ngoduykhanh commented on GitHub (Jul 13, 2016):
Actually now we can re-run
create_db.pyscript to create missing tables.@ivanfilippov commented on GitHub (Jul 13, 2016):
Oh cool, I didn't know that. So running
create_db.pyafter we change the models will do the same thing as doing adb_migrate.pyanddb_upgrade.py?@joachimtingvold commented on GitHub (Jul 13, 2016):
I still can't see how the
domain_settingtable would be created for new installs as it is now? You'd need to editcreate_db.pyas a minimum? It currently only handles theRoleandSettingclasses frommodels.py, and your PR didn't change that file at all.@joachimtingvold commented on GitHub (Jul 13, 2016):
Hmm, never mind. I guess the init-thingie is just for tables that needs initial values, which is not the case for the
domain_setting.@ngoduykhanh commented on GitHub (Jul 13, 2016):
@ivanfilippov : no,
create_db.pyscript only help to create missing tables and initialize the configs such as User/Roles/Settings.@jallakim :
create_db.pywas changed in another PR (#84) which contributed by @winggundamth . Let's check the latestcreate_db.pyscript in the master branch.