← Back to team overview

maas-devel team mailing list archive

Re: Help with new custom kernel_opts

 

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11/14/2012 6:36 AM, Jeff Marcom wrote:
> Hello,
> 
> I'm currently adding the new kernel_opts (via tags) in my custom
> script and I'm running into a problem.
> 


 node.tags.add(tag)

should be identical to

 tag.node_set.add(node)


> Sample:
> 
> passed => hostname="201101-6951"
> 
> tagged_node = Node.objects.get(hostname=hostname) kernel_options =
> " ".join(( preseed, boot_type, initrd, netboot, full_distro_path))
> 
> # Create new Tag with contructed values new_item =
> tagged_node.tags.create( name=tag_name, definition="true", 
> kernel_opts=kernel_options)
> 
> created_tag = Tag.objects.get(name=tag_name) 
> created_tag.node_set.add(tagged_node)
> 
> 
> This seems to work well using the maas shell. However, when I run
> the script I can see that it creates the tag with the correct
> kernel parameters. However it does not update the node information
> in the UI. The node.get_effective_kernel_paramaters() shows (None,
> None).

Can you do 'tagged_node.tags.all()' and see if it is actually getting
added? The change should be immediate.

> 
> Again, If I do a simple grab of the tag that was just created via
> the script I'm running:
> 
> custom_tag =
> maasserver.models.Tag.objects.get(name="quantal_install_opts") then
> do the following workerNode =
> maassserver.modes.Node.objects.get(hostname="201101-6951") 
> workerNode.tags.add(custom_tag)
> 
> It works fine. Is there something else that needs to be called in
> my script to update node with the proper tag?
> 
> Thanks

I'm a little surprised about the 'tagged_node.tags.create' vs
Tag.objects.create.

If you drop by IRC, (#maas) I'll be happy to do more live debugging
with you.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (Cygwin)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iEYEARECAAYFAlCjI64ACgkQJdeBCYSNAAP5DACfTWf3ibo8JgoTWvHYcTyQR5on
2bMAnjj0OMbSvoGy1EIfuoWOyOpzSs1c
=gvto
-----END PGP SIGNATURE-----


References