From: Tony Mack Date: Fri, 16 Dec 2011 18:49:10 +0000 (-0500) Subject: added the -c --current command line argument for ListResources which allows clients... X-Git-Tag: sfa-2.0-7~15 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=703f91b9fa60e8f958c3da73927e4111942387ac;p=sfa.git added the -c --current command line argument for ListResources which allows clients to bypass the SM/AM cache and request the current advertisement rspec --- diff --git a/sfa/client/sfi.py b/sfa/client/sfi.py index 73d00997..83cd9bf8 100644 --- a/sfa/client/sfi.py +++ b/sfa/client/sfi.py @@ -255,8 +255,6 @@ class Sfi: # user specifies remote aggregate/sm/component if command in ("resources", "slices", "create", "delete", "start", "stop", "restart", "shutdown", "get_ticket", "renew", "status"): - parser.add_option("-c", "--component", dest="component", default=None, - help="component hrn") parser.add_option("-d", "--delegate", dest="delegate", default=None, action="store_true", help="Include a credential delegated to the user's root"+\ @@ -268,10 +266,15 @@ class Sfi: help="type filter ([all]|user|slice|authority|node|aggregate)", choices=("all", "user", "slice", "authority", "node", "aggregate"), default="all") - # display formats if command in ("resources"): + # rspec version parser.add_option("-r", "--rspec-version", dest="rspec_version", default="SFA 1", help="schema type and version of resulting RSpec") + # disable/enable cached rspecs + parser.add_option("-c", "--current", dest="current", default=False, + action="store_true", + help="Request the current rspec bypassing the cache. Cached rspecs are returned by default") + # display formats parser.add_option("-f", "--format", dest="format", type="choice", help="display format ([xml]|dns|ip)", default="xml", choices=("xml", "dns", "ip")) @@ -828,6 +831,11 @@ or with an slice hrn, shows currently provisioned resources api_options['geni_slice_urn'] = hrn_to_urn(hrn, 'slice') if options.info: api_options['info'] = options.info + if options.current: + if options.current == True: + api_options['cached'] = False + else: + api_options['cached'] = True if options.rspec_version: version_manager = VersionManager() server_version = self.get_cached_server_version(server) diff --git a/sfa/managers/slice_manager.py b/sfa/managers/slice_manager.py index be6cc7e2..e22ec50c 100644 --- a/sfa/managers/slice_manager.py +++ b/sfa/managers/slice_manager.py @@ -131,7 +131,8 @@ class SliceManager: version_string = "rspec_%s" % (rspec_version) # look in cache first - if self.cache and not xrn: + cached_requested = options.get('cached', True) + if not xrn and self.cache and cached_request: rspec = self.cache.get(version_string) if rspec: api.logger.debug("SliceManager.ListResources returns cached advertisement")