Changeset 5d854e1


Ignore:
Timestamp:
Sep 21, 2010 3:12:16 PM (14 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master
Children:
3bf0b3c
Parents:
87807f42
Message:

allow FEDD_URL in the environment to set the contact URL. Man am I sick of typing --url.

Location:
fedd
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • fedd/fedd_create.py

    r87807f42 r5d854e1  
    8484
    8585
    86 cert, fid = wrangle_standard_options(opts)
     86cert, fid, url = wrangle_standard_options(opts)
    8787
    8888if opts.file:
     
    127127try:
    128128    resp_dict = do_rpc(msg,
    129             opts.url, opts.transport, cert, opts.trusted,
     129            url, opts.transport, cert, opts.trusted,
    130130            serialize_only=opts.serialize_only,
    131131            tracefile=opts.tracefile,
     
    166166try:
    167167    resp_dict = do_rpc(msg,
    168             opts.url, opts.transport, cert, opts.trusted,
     168            url, opts.transport, cert, opts.trusted,
    169169            serialize_only=opts.serialize_only,
    170170            tracefile=opts.tracefile,
  • fedd/fedd_ftopo.py

    r87807f42 r5d854e1  
    1919(opts, args) = parser.parse_args()
    2020try:
    21     cert, fid = wrangle_standard_options(opts)
     21    cert, fid, url = wrangle_standard_options(opts)
    2222except RuntimeError, e:
    2323    sys.exit("%s" % e)
     
    3636try:
    3737    resp_dict = do_rpc(req,
    38             opts.url, opts.transport, cert, opts.trusted,
     38            url, opts.transport, cert, opts.trusted,
    3939            serialize_only=opts.serialize_only,
    4040            tracefile=opts.tracefile,
  • fedd/fedd_image.py

    r87807f42 r5d854e1  
    181181        raise RuntimeError("Bad response. %s" % e.message)
    182182
    183 def get_experiment_topo(opts, cert):
     183def get_experiment_topo(opts, cert, url):
    184184    """
    185185    Get the topology of an existing experiment from a running fedd.  That is,
     
    204204    req = { 'experiment': exp_id }
    205205    resp_dict = do_rpc(req,
    206             opts.url, opts.transport, cert, opts.trusted,
     206            url, opts.transport, cert, opts.trusted,
    207207            serialize_only=opts.serialize_only,
    208208            tracefile=opts.tracefile,
     
    211211    return extract_topo_from_message(resp_dict, opts.serialize_only)
    212212
    213 def get_file_topo(opts, cert):
     213def get_file_topo(opts, cert, url):
    214214    """
    215215    Parse a topology file or convert an ns2 file into a topdl.Topology.  XML
     
    238238    if opts.debug > 1: print >>sys.stderr, msg
    239239    resp_dict = do_rpc(msg,
    240             opts.url, opts.transport, cert, opts.trusted,
     240            url, opts.transport, cert, opts.trusted,
    241241            serialize_only=opts.serialize_only,
    242242            tracefile=opts.tracefile,
     
    252252# not be a big deal.  It's checked if needed below
    253253try:
    254     cert, fid = wrangle_standard_options(opts)
     254    cert, fid, url = wrangle_standard_options(opts)
    255255except RuntimeError, e:
    256256    cert = None
     
    285285        sys.exit("Couldn't find an identity certificate, RPC (Info) needed.")
    286286    try:
    287         top = get_experiment_topo(opts, cert)
     287        top = get_experiment_topo(opts, cert, url)
    288288    except RPCException, e:
    289289        exit_with_fault(e)
     
    296296                % opts.file
    297297    try:
    298         top = get_file_topo(opts, cert)
     298        top = get_file_topo(opts, cert, url)
    299299    except RPCException, e:
    300300        print >>sys.stderr, "Cannot extract a topology from %s" % opts.file
  • fedd/fedd_info.py

    r87807f42 r5d854e1  
    2222parser = exp_data_opts()
    2323(opts, args) = parser.parse_args()
    24 cert, fid = wrangle_standard_options(opts)
     24cert, fid, url = wrangle_standard_options(opts)
    2525
    2626if opts.exp_name and opts.exp_certfile:
     
    3737try:
    3838    resp_dict = do_rpc(req,
    39             opts.url, opts.transport, cert, opts.trusted,
     39            url, opts.transport, cert, opts.trusted,
    4040            serialize_only=opts.serialize_only,
    4141            tracefile=opts.tracefile,
  • fedd/fedd_multiinfo.py

    r87807f42 r5d854e1  
    2525parser = exp_data_opts()
    2626(opts, args) = parser.parse_args()
    27 cert, fid = wrangle_standard_options(opts)
     27cert, fid, url = wrangle_standard_options(opts)
    2828
    2929try:
    3030    resp_dict = do_rpc({ },
    31             opts.url, opts.transport, cert, opts.trusted,
     31            url, opts.transport, cert, opts.trusted,
    3232            serialize_only=opts.serialize_only,
    3333            tracefile=opts.tracefile,
  • fedd/fedd_multistatus.py

    r87807f42 r5d854e1  
    99parser = client_opts()
    1010(opts, args) = parser.parse_args()
    11 cert, fid = wrangle_standard_options(opts)
     11cert, fid, url = wrangle_standard_options(opts)
    1212
    1313try:
    1414    resp_dict = do_rpc({ },
    15             opts.url, opts.transport, cert, opts.trusted,
     15            url, opts.transport, cert, opts.trusted,
    1616            serialize_only=opts.serialize_only,
    1717            tracefile=opts.tracefile,
  • fedd/fedd_new.py

    r87807f42 r5d854e1  
    1919(opts, args) = parser.parse_args()
    2020
    21 cert, fid = wrangle_standard_options(opts)
     21cert, fid, url = wrangle_standard_options(opts)
    2222
    2323out_certfile = opts.out_certfile
     
    3232try:
    3333    resp_dict = do_rpc(msg,
    34             opts.url, opts.transport, cert, opts.trusted,
     34            url, opts.transport, cert, opts.trusted,
    3535            serialize_only=opts.serialize_only,
    3636            tracefile=opts.tracefile,
  • fedd/fedd_ns2topdl.py

    r87807f42 r5d854e1  
    1919(opts, args) = parser.parse_args()
    2020
    21 cert, fid = wrangle_standard_options(opts)
     21cert, fid, url = wrangle_standard_options(opts)
    2222
    2323if opts.file:
     
    3535try:
    3636    resp_dict = do_rpc(msg,
    37             opts.url, opts.transport, cert, opts.trusted,
     37            url, opts.transport, cert, opts.trusted,
    3838            serialize_only=opts.serialize_only,
    3939            tracefile=opts.tracefile,
  • fedd/fedd_spewlog.py

    r87807f42 r5d854e1  
    2525(opts, args) = parser.parse_args()
    2626
    27 cert, fid = wrangle_standard_options(opts)
     27cert, fid, url = wrangle_standard_options(opts)
    2828
    2929if opts.exp_name and opts.exp_certfile:
     
    5353    try:
    5454        resp_dict = do_rpc(req,
    55                 opts.url, opts.transport, cert, opts.trusted,
     55                url, opts.transport, cert, opts.trusted,
    5656                serialize_only=opts.serialize_only,
    5757                tracefile=opts.tracefile,
  • fedd/fedd_terminate.py

    r87807f42 r5d854e1  
    2727parser = terminate_opts()
    2828(opts, args) = parser.parse_args()
    29 cert, fid = wrangle_standard_options(opts)
     29cert, fid, url = wrangle_standard_options(opts)
    3030
    3131if opts.exp_name and opts.exp_certfile:
     
    5454try:
    5555    resp_dict = do_rpc(req,
    56             opts.url, opts.transport, cert, opts.trusted,
     56            url, opts.transport, cert, opts.trusted,
    5757            serialize_only=opts.serialize_only,
    5858            tracefile=opts.tracefile,
  • fedd/federation/client_lib.py

    r87807f42 r5d854e1  
    3333                type="string", help="Trusted certificates (required)")
    3434        self.add_option("--url", action="store", dest="url",
    35                 type="string",default="https://localhost:23235", 
    36                 help="URL to connect to (default %default)")
     35                type="string",default=None, help="URL to connect to")
    3736        self.add_option("--transport", action="store", type="choice",
    3837                choices=("xmlrpc", "soap"), default="soap",
     
    9089    and if the debug level is set, set the tracefile attribute as well.  If any
    9190    of these tests fail, raise a RuntimeError.  Otherwise return the
    92     certificate file and the dedid.
    93     """
     91    certificate file, the fedid, and the fedd url.
     92    """
     93    default_url="https://localhost:23235"
     94
    9495    if opts.debug > 0: opts.tracefile=sys.stderr
    9596
     
    110111        raise RuntimeError("Cannot read certificate (%s)" % cert)
    111112
    112     return (cert, fid)
     113    if opts.url: url = opts.url
     114    elif 'FEDD_URL' in os.environ: url = os.environ['FEDD_URL']
     115    else: url = default_url
     116
     117
     118    return (cert, fid, url)
    113119
    114120def save_certfile(out_certfile, ea):
Note: See TracChangeset for help on using the changeset viewer.