import pickle
import json
import shutil
+
+# import bonfire.py for listing bonfire resources
+import bonfire
+
from lxml import etree
from StringIO import StringIO
from optparse import OptionParser
save_rspec_to_file(value, options.file)
if (self.options.raw is None) and (options.file is None):
display_rspec(value, options.format)
+ #adding resources from bonfire
+ bonfire_resources = bonfire.bonsources()
+ display_rspec(bonfire_resources, options.format)
return
$ sfi -v myslice -- or sfi -vv myslice
same but with more and more verbosity
-$ sfi m
+$ sfi m -b http://mymanifold.foo.com:7080/
is synonym to sfi myslice as no other command starts with an 'm'
+ and uses a custom backend for this one call
"""
) # register_command
def myslice (self, options, args):
# enable info by default
self.logger.setLevelFromOptVerbose(self.options.verbose+1)
### the rough sketch goes like this
+ # (0) produce a p12 file
+ self.client_bootstrap.my_pkcs12()
+
# (a) rain check for sufficient config in sfi_config
myslice_dict={}
- myslice_keys=['backend', 'delegate', 'platform', 'username']
+ myslice_keys=[ 'backend', 'delegate', 'platform', 'username']
for key in myslice_keys:
value=None
# oct 2013 - I'm finding myself juggling with config files
# so a couple of command-line options can now override config
- if hasattr(args,key):
- value=getattr(args,key)
+ if hasattr(options,key) and getattr(options,key) is not None:
+ value=getattr(options,key)
else:
full_key="MYSLICE_" + key.upper()
value=getattr(self.config_instance,full_key,None)
# (f) and finally upload them to manifold server
# xxx todo add an option so the password can be set on the command line
# (but *NOT* in the config file) so other apps can leverage this
+ self.logger.info("Uploading on backend at %s"%myslice_dict['backend'])
uploader = ManifoldUploader (logger=self.logger,
url=myslice_dict['backend'],
platform=myslice_dict['platform'],
if uploader.upload(delegated_credential,message=message):
count_success+=1
count_all+=1
-
self.logger.info("Successfully uploaded %d/%d credentials"%(count_success,count_all))
+
# at first I thought we would want to save these,
# like 'sfi delegate does' but on second thought
# it is probably not helpful as people would not