Friday, 2013-09-13

*** eankutse has joined #openstack-dns00:02
*** jmcbride has joined #openstack-dns00:06
*** zane has quit IRC00:11
*** eankutse has quit IRC00:37
*** jmcbride has quit IRC00:41
*** jmcbride has joined #openstack-dns00:47
*** nosnos has joined #openstack-dns01:06
*** jmcbride has quit IRC03:37
*** betsy has quit IRC04:00
*** nosnos has quit IRC10:26
*** nosnos has joined #openstack-dns10:27
*** nosnos has quit IRC10:27
*** nosnos has joined #openstack-dns10:28
*** nosnos has quit IRC10:35
openstackgerritKiall Mac Innes proposed a change to stackforge/designate: Allow default SOA values to be configured  https://review.openstack.org/4646910:36
*** nosnos has joined #openstack-dns10:36
*** nosnos has quit IRC10:40
*** CaptTofu has quit IRC12:34
*** betsy has joined #openstack-dns12:47
openstackgerritA change was merged to stackforge/designate: Allow default SOA values to be configured  https://review.openstack.org/4646912:56
*** eankutse has joined #openstack-dns13:18
*** eankutse has quit IRC13:19
*** eankutse has joined #openstack-dns13:19
kialleankutse: Heya - Sorry, haven't had a chance to respond to your email yet.. Busy day so far :)13:34
eankutseKiall: np. whenever you get the chance :-)13:39
kiallSure - Short answer, we probably need to do something along the lines of UPDATE records SET content = SUBSTR(content, 'oldname', 'newname') WHERE type = SOA AND content LIKE '%oldname%';13:40
kiall(wrapped in a TX)13:40
kiallLong answer: I haven't looked close enough yet :)13:40
eankutseso SUBSTR is part of the SQLAlchemy SQL Expression Language?13:40
kiallyea .. `from sqlalchemy import func` when update().values(content=func.substring(something here)).execute()13:41
kialls/when/then/13:42
eankutsek. That's cool. Thanks :-)13:42
kiallRe the TX.. I'm working on a bug at the mo that needs one in the powerdns driver.. http://pastie.org/private/19shedjf5hfzrqp8ea13:42
kiallthat should be a half decent example13:43
eankutseYes. I am wrapping in TX for atomicity13:43
kiallehh.. more like this actually.. a commit is useful ;) http://pastie.org/private/1l0amf1oy7mw4rmpoyg6uq13:44
eankutseYes. That's what I am doing. I just did not know about the func.substring(). That should be very helpful.13:46
*** betsy has quit IRC13:56
*** jmcbride has joined #openstack-dns14:12
*** jmcbride has quit IRC14:13
*** jmcbride has joined #openstack-dns14:14
*** msisk has joined #openstack-dns14:26
*** betsy has joined #openstack-dns14:43
*** artom has quit IRC14:52
eankutseKiall: I think my main problem is that the 'content' field in the records table is defined in impl_powerdns/models.py as:  content = Column(Text, default=None, nullable=True). So, in order to perform a substr operation or any other string operation on the value in the field one has to be able to retrieve the value from that field as a string and to do this within the bulk query that I am using. So, in the query, when I reference records.c.content how w15:58
kialleankutse: message get cut off?16:01
eankutseKiall: oh, my message is incomplete?16:03
eankutseI'll try again16:03
kiallYea - got cut off at "when I reference records.c.content how w"16:03
kiall(Most IRC clients are smart enough to split long messages when the reach the limit for IRC ;)16:03
eankutse… when I reference records.c.content, how would I extract a String object out of it in order to manipulate it with string operatiions?16:05
kiallSo, It sounds like your trying to do it in python, rather than at the DB? e.g.16:05
eankutseno, I am using SQLAlchemy SQL expressions16:06
kiallUPDATE records SET content = SUBSTR(content, 'oldns.example.org.', 'newns.example.org.') WHERE content LIKE 'oldns.example.org. %';16:06
kialland a where clause ;)16:06
eankutseThis is what I have:16:07
eankutse# Update the content field of every SOA record that has the16:07
eankutse        # old server name as part of its 'content' field to reflect16:07
eankutse        # the new server name16:07
eankutse        self.session.execute(models.Record.__table__.16:07
eankutse        update().16:07
eankutse        where(and_(models.Record.__table__.c.type=="SOA",16:07
eankutse                   models.Record.__table__.c.content.like16:07
eankutse                       ("%s%%" % old_server_name))16:07
eankutse        ).16:07
eankutse        values(content=_replace_server_name(XXXXXX, old_server_name, server['name']))16:07
eankutse        )16:07
kiallSo - We're not needing to load a string .. something like this might work (off to top of my head)16:07
eankutseXXXX should be the value from the records.c.content field16:07
kiallsession.query(models.Record).filter_by(models.Record.content.like("OldNameServer %")).update(content=func.substring(models.Record.content, 'OldNameServer', 'NewNameServer'))16:08
kiallwhoops - more like16:09
kiallsession.query(models.Record).filter(models.Record.content.like("OldNameServer %")).filter_by(type='SOA').update(content=func.substring(models.Record.content, 'OldNameServer', 'NewNameServer'))16:09
kiallSo in your example, "_replace_server_name" shouldn't be a python function you call16:10
kiall(well - not one you define youself! You would use SQLA's func.substring() function)16:11
eankutseso func.substring() will replace the first occurance of 'OldNameServer' in models.Record.content with 'NewNameServer'?16:12
kiallcontent=func.substring(ColReference, 'find', 'replace')16:13
kiallwill cause SQLA to emit:16:13
kiallSET content = SUBSTR(content, 'find', 'replace')16:13
eankutseok.16:13
kiallwhich will do what we need :)16:13
eankutseYes. I'll try func.substring function. Thx Kiall :-)16:14
kiallNo problem :)16:14
* kiall gets back to beating flake8 with a sledge hammer16:14
eankutse:-)16:14
openstackgerritKiall Mac Innes proposed a change to stackforge/designate: Ensure default TTL is respected by PowerDNS backend  https://review.openstack.org/4652916:15
kiallAHHHH! https://github.com/jcrocholl/pep8/commit/15392bdaa73fbf9881a3f0eadd3eef5b9db1adfb16:36
kiallpep8 bug preventing me from ignoring these invalid errors  -_-16:37
openstackgerritKiall Mac Innes proposed a change to stackforge/designate: Ensure default TTL is respected by PowerDNS backend  https://review.openstack.org/4652916:38
*** CaptTofu has joined #openstack-dns16:53
*** jmcbride has quit IRC17:20
*** CaptTofu has quit IRC17:30
*** eankutse has quit IRC17:33
openstackgerritA change was merged to stackforge/designate: Ensure default TTL is respected by PowerDNS backend  https://review.openstack.org/4652917:44
*** vipul is now known as vipul-away17:49
*** vipul-away is now known as vipul17:52
*** eankutse has joined #openstack-dns18:05
*** tsimmons has joined #openstack-dns18:07
*** jmcbride has joined #openstack-dns18:09
*** jmcbride has quit IRC18:10
*** jmcbride has joined #openstack-dns18:10
*** jmcbride1 has joined #openstack-dns18:17
*** jmcbride1 has joined #openstack-dns18:17
*** jmcbride has quit IRC18:17
*** tsimmons has quit IRC18:38
*** tsimmons has joined #openstack-dns18:51
*** jmcbride1 has quit IRC19:01
*** jmcbride has joined #openstack-dns19:05
*** jmcbride1 has joined #openstack-dns19:06
*** jmcbride1 has quit IRC19:07
*** jmcbride1 has joined #openstack-dns19:07
*** jmcbride has quit IRC19:10
*** zane has joined #openstack-dns19:24
*** tsimmons1 has joined #openstack-dns19:31
*** msisk has quit IRC19:34
*** tsimmons has quit IRC19:35
*** msisk has joined #openstack-dns19:37
*** betsy has quit IRC19:46
*** tsimmons1 has quit IRC19:52
*** tsimmons has joined #openstack-dns19:53
*** msisk has quit IRC20:13
*** msisk has joined #openstack-dns21:03
*** msisk has quit IRC21:03
eankutseKiall: There is a func.replace() as well so that does the job. Thx.21:09
*** openstackgerrit has quit IRC21:14
*** tsimmons1 has joined #openstack-dns21:26
*** tsimmons has quit IRC21:30
*** tsimmons1 has quit IRC21:31
*** shakayumi has joined #openstack-dns22:12
*** shakayumi has quit IRC22:18
*** jmcbride has joined #openstack-dns22:20
*** jmcbride1 has quit IRC22:21
*** eankutse has quit IRC22:24
*** jmcbride1 has joined #openstack-dns22:44
*** jmcbride has quit IRC22:48
*** zane has quit IRC23:20
*** eankutse has joined #openstack-dns23:28
*** eankutse has quit IRC23:52
*** jmcbride1 has quit IRC23:57

Generated by irclog2html.py 2.14.0 by Marius Gedminas - find it at mg.pov.lt!