[Planetlab-devel] editRecord.py (geniwrapper)
Ihsan Qazi
iqazi at bbn.com
Mon Jun 29 20:04:35 EDT 2009
Hi Faiyaz,
Thanks! The getRecord.py and SetRecord.py methods were quite helpful.
I have another observation. While I'm able to update 'user' records via
sfi, I get a "Missing authority" exception when updating a 'slice'
record, even though I can delete a named slice or remove it from the
registry. It appears that the name of the slice, which is pl_test1 in my
case, is read from the XML file and set to the hrn, which I think is not
the right assignment to do (unless it gets translated to the hrn
somehow). It should, perhaps, be set to plc.pl.test1 (which is the hrn
of the slice in my case). I checked this in the code, it turns out that
when I delete a named slice, the argument of the function
'get_slice_hrn(slice_hrn)' is set to the hrn of the slice (which is
given from the command-line) but when updating a slice record, it is set
to the name rather than the hrn of the slice. Note that this is not the
case with a user record, in which case the name==hrn in the XML file and
so this issue doesn't arise. When I set the name equal to hrn in the XML
file manually, I get a "500 Internal Server Error", which suggests that
the setting of the name perhaps had something to do with the issue but
not sure why the Internal Server Error appears. Have you tried updating
a slice record via sfi?
I have copied the output below.
Thanks!
Ihsan
./sfi.py update ~/.sfi/test1.record
Traceback (most recent call last):
File "./sfi.py", line 703, in <module>
main()
File "./sfi.py", line 371, in main
dispatch(command, cmd_opts, cmd_args)
File "./sfi.py", line 337, in dispatch
globals()[command](cmd_opts, cmd_args)
File "./sfi.py", line 509, in update
cred = get_slice_cred(record.get_name())
File "./sfi.py", line 179, in get_slice_cred
slice_cred = registry.get_credential(user_cred, "slice", name)
File "usr/lib/python2.5/site-packages/geni/util/geniclient.py", line
157, in get_credential
File "/usr/lib/python2.5/xmlrpclib.py", line 1150, in __call__
return self.__send(self.__name, args)
File "/usr/lib/python2.5/xmlrpclib.py", line 1440, in __request
verbose=self.__verbose
File "/usr/lib/python2.5/xmlrpclib.py", line 1204, in request
return self._parse_response(h.getfile(), sock)
File "/usr/lib/python2.5/xmlrpclib.py", line 1343, in _parse_response
return u.close()
File "usr/lib/python2.5/site-packages/geni/util/geniclient.py", line 30,
in close
geni.util.geniclient.ServerException: : get_credential: Missing
authority: pl_test1
./sfi.py create plc.pl.test1 ~/.sfi/slice.rspec
Traceback (most recent call last):
File "./sfi.py", line 703, in <module>
main()
File "./sfi.py", line 371, in main
dispatch(command, cmd_opts, cmd_args)
File "./sfi.py", line 337, in dispatch
globals()[command](cmd_opts, cmd_args)
File "./sfi.py", line 579, in create
return slicemgr.create_slice(slice_
cred, slice_hrn, rspec)
File "usr/lib/python2.5/site-packages/geni/util/geniclient.py", line
274, in create_slice
File "/usr/lib/python2.5/xmlrpclib.py", line 1150, in __call__
return self.__send(self.__name, args)
File "/usr/lib/python2.5/xmlrpclib.py", line 1440, in __request
verbose=self.__verbose
File "/usr/lib/python2.5/xmlrpclib.py", line 1194, in request
headers
xmlrpclib.ProtocolError: <ProtocolError for ***: 500 Internal Server Error>
where *** is the name of the machine I'm using
Faiyaz Ahmed wrote:
> Hi Scott and Ihsan,
>
> Please take a look at getRecord.py and setRecord.py. I believe they
> subsume what editRecord could do.
>
> getRecord will display a record collected from sfi and setRecord can
> edit fields in it.
>
> For example:
> # to get a record from sfi, and write it to ~/.sfi/
> $ ./sfi.py show -o faiyaza.record plc.princeton.faiyaza
>
> # to see what is in this record
> $ /getRecord.py < ~/.sfi/faiyaza.record
> last_name: Ahmed
> ...
>
> # to edit a field in the record
> ./setRecord.py last_name=foo < ~/.sfi/faiyaza.record >
> ~/.sfi/faiyaza.new.record
>
> # to display the new record
> $ ./getRecord.py < ~/.sfi/faiyaza.new.record
> last_name: foo
>
> Use the --help flag for more information.
>
> Your comments are more than welcome. Please let me know if these
> utilities need anything else.
>
>
> Faiyaz
>
>
> On Jun 29, 2009, at 1:30 PM, Scott Baker wrote:
>
>> There have been some changes to the record class and editRecord.py has
>> fallen a bit behind. It's on my to-do list to look into the changes
>> and get editRecord.py back up to date. In the meantime, the records
>> are XML files, so it should be possible to manually edit them with any
>> text editor. EditRecord.py really only served as an automated tool to
>> edit the XML for the user.
>>
>> I was able to make a simple code substitution last week and get some
>> rudimentary editRecord functionality working:
>>
>> geni_info = record["geni_info"][0] # record.get_geni_info()
>>
>> However, looking at the changes in record.py, I can see that there are
>> some significant changes; In particular there are now individual
>> classes for user records, slice records, etc. Tony: if you can give me
>> a quick sample on how to use these classes, I can see if I can get
>> editRecord.py updated to use them.
>>
>> Scott
>>
>> On Mon, Jun 29, 2009 at 9:32 AM, Ihsan Qazi<iqazi at bbn.com> wrote:
>>> Hi,
>>>
>>> While trying to create slices via the sfi, I noticed that the
>>> editRecord.py
>>> (in /geniwrapper/trunk/cmdline/) file contains a call to a function
>>> that is
>>> no longer part of the GeniRecord class. Therefore, when I try
>>> creating a new
>>> record, I get the following error:
>>>
>>> python ./editRecord.py --hrn plc.pl.testslice --pubkeyfile testkey.pkey
>>> --type slice --addresearcher $SFI_USER --outfile testslice_record
>>> Traceback (most recent call last):
>>> File "./editRecord.py", line 218, in <module>
>>> main()
>>> File "./editRecord.py", line 161, in main
>>> geni_info = record.get_geni_info()
>>> AttributeError: 'GeniRecord' object has no attribute 'get_geni_info'
>>>
>>> Thanks!
>>> Ihsan
>>>
>>> _______________________________________________
>>> Devel mailing list
>>> Devel at lists.planet-lab.org
>>> https://lists.planet-lab.org/mailman/listinfo/devel
>>>
>>>
>>
>> _______________________________________________
>> Devel mailing list
>> Devel at lists.planet-lab.org
>> https://lists.planet-lab.org/mailman/listinfo/devel
>
> _______________________________________________
> Devel mailing list
> Devel at lists.planet-lab.org
> https://lists.planet-lab.org/mailman/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.planet-lab.org/pipermail/devel/attachments/20090629/436ef15c/attachment.html
More information about the Devel
mailing list