return True
- def __init__(self, api):
+ def __init__(self, api,caller=None):
self.name = self.__class__.__name__
self.api = api
- # Auth may set this to a Person instance (if an anonymous
- # method, will remain None).
- self.caller = None
+ if caller:
+ # let a method call another one by propagating its caller
+ self.caller=caller
+ else:
+ # Auth may set this to a Person instance (if an anonymous
+ # method, will remain None).
+ self.caller = None
+
# API may set this to a (addr, port) tuple if known
self.source = None
-# $Id$
-# $URL$
import random
import base64
import os
node_id=node['node_id']
# no support for deployment-based BootCD's, use kvariants instead
- node_pldistro = GetNodePldistro (self.api).call(auth, node_id)
+ node_pldistro = GetNodePldistro (self.api,self.caller).call(auth, node_id)
if node_pldistro: pldistro = node_pldistro
- node_fcdistro = GetNodeFcdistro (self.api).call(auth, node_id)
+ node_fcdistro = GetNodeFcdistro (self.api,self.caller).call(auth, node_id)
if node_fcdistro: fcdistro = node_fcdistro
- node_arch = GetNodeArch (self.api).call(auth,node_id)
+ node_arch = GetNodeArch (self.api,self.caller).call(auth,node_id)
if node_arch: arch = node_arch
return (pldistro,fcdistro,arch)
# the deployment tag, if set, wins
# xxx Thierry: this probably is wrong; we need fcdistro to be set anyway
# for generating the proper yum config....
- deployment = GetNodeDeployment (self.api).call(auth,node_id)
+ deployment = GetNodeDeployment (self.api,self.caller).call(auth,node_id)
if deployment: return deployment
- pldistro = GetNodePldistro (self.api).call(auth, node_id)
+ pldistro = GetNodePldistro (self.api,self.caller).call(auth, node_id)
if not pldistro:
pldistro = self.api.config.PLC_FLAVOUR_NODE_PLDISTRO
SetNodePldistro(self.api).call(auth,node_id,pldistro)
def extensions (self, auth, node_id, fcdistro, arch):
try:
- return [ "%s-%s-%s"%(e,fcdistro,arch) for e in GetNodeExtensions(self.api).call(auth,node_id).split() ]
+ return [ "%s-%s-%s"%(e,fcdistro,arch) for e in GetNodeExtensions(self.api,self.caller).call(auth,node_id).split() ]
except:
return []
def plain (self, auth, node_id):
- return not not GetNodePlainBootstrapfs(self.api).call(auth,node_id)
+ return not not GetNodePlainBootstrapfs(self.api,self.caller).call(auth,node_id)
def call(self, auth, node_id_or_name):
# Get node information
node = nodes[0]
node_id = node['node_id']
- arch = GetNodeArch (self.api).call(auth,node_id)
+ arch = GetNodeArch (self.api,self.caller).call(auth,node_id)
# if not set, use the global default and tag the node, in case the global default changes later on
if not arch:
arch = self.api.config.PLC_FLAVOUR_NODE_ARCH
SetNodeArch (self.api).call(auth,node_id,arch)
- fcdistro = GetNodeFcdistro (self.api).call(auth, node_id)
+ fcdistro = GetNodeFcdistro (self.api,self.caller).call(auth, node_id)
if not fcdistro:
fcdistro = self.api.config.PLC_FLAVOUR_NODE_FCDISTRO
SetNodeFcdistro (self.api).call (auth, node_id, fcdistro)
-# $Id$
-# $URL$
from PLC.Method import Method
from PLC.Auth import Auth
from PLC.Faults import *
slice = slices[0]
slice_id = slice['slice_id']
- arch = GetSliceArch (self.api).call(auth,slice_id)
+ arch = GetSliceArch (self.api,self.caller).call(auth,slice_id)
if not arch: arch = self.api.config.PLC_FLAVOUR_SLICE_ARCH
- pldistro = GetSlicePldistro (self.api).call(auth, slice_id)
+ pldistro = GetSlicePldistro (self.api,self.caller).call(auth, slice_id)
if not pldistro: pldistro = self.api.config.PLC_FLAVOUR_SLICE_PLDISTRO
- fcdistro = GetSliceFcdistro (self.api).call(auth, slice_id)
+ fcdistro = GetSliceFcdistro (self.api,self.caller).call(auth, slice_id)
if not fcdistro: fcdistro = self.api.config.PLC_FLAVOUR_SLICE_FCDISTRO
# the vref tag, if set, wins over pldistro
- vref = GetSliceVref (self.api).call(auth,slice_id)
+ vref = GetSliceVref (self.api,self.caller).call(auth,slice_id)
# omf-control'ed slivers need the omf vserver reference image
# this is to avoid asking users to set both tags 'omf_control' and 'vref'
- if not vref and GetSliceOmfControl(self.api).call(auth,slice_id):
+ if not vref and GetSliceOmfControl(self.api,self.caller).call(auth,slice_id):
SetSliceVref (self.api) (auth,slice_id,'omf')
vref='omf'
data = {
'timestamp': int(time.time()),
'initscripts': initscripts,
- 'slivers': get_slivers(self.api, auth, [slice['slice_id']]),
+ 'slivers': get_slivers(self.api, self.caller, auth, [slice['slice_id']]),
}
# Sign ticket
-# $Id$
-# $URL$
import time
from PLC.Faults import *
MAXINT = 2L**31-1
# slice_filter essentially contains the slice_ids for the relevant slices (on the node + system & delegated slices)
-def get_slivers(api, auth, slice_filter, node = None):
+def get_slivers(api, caller, auth, slice_filter, node = None):
# Get slice information
slices = Slices(api, slice_filter, ['slice_id', 'name', 'instantiation', 'expires', 'person_ids', 'slice_tag_ids'])
if slice['expires'] > MAXINT: slice['expires']= MAXINT
# expose the slice vref as computed by GetSliceFamily
- family = GetSliceFamily (api).call(auth, slice['slice_id'])
+ family = GetSliceFamily (api,caller).call(auth, slice['slice_id'])
slivers.append({
'name': slice['name'],
controller_and_delegated_slice_ids = controller_and_delegated_slices.keys()
slice_ids = system_slice_ids + controller_and_delegated_slice_ids + node['slice_ids']
- slivers = get_slivers(self.api, auth, slice_ids, node)
+ slivers = get_slivers(self.api, self.caller, auth, slice_ids, node)
# get the special accounts and keys needed for the node
# root
personsitekeys=get_all_admin_keys(self.api)
accounts.append({'name':'root','keys':personsitekeys})
- hrn = GetNodeHrn(self.api).call(auth,node['node_id'])
+ hrn = GetNodeHrn(self.api,self.caller).call(auth,node['node_id'])
# XMPP config for omf federation
try: