rc3_link="/vservers/%s/etc/rc.d/rc3.d/S99vinit"%self.name
rc3_target="../init.d/vinit"
# install in sliver
- body=file(vinit_source).read()
- if tools.replace_file_with_string(vinit_script,body,chmod=0755):
+ code=file(vinit_source).read()
+ if tools.replace_file_with_string(vinit_script,code,chmod=0755):
logger.log("vsliver_vs: %s: installed generic vinit rc script"%self.name)
# create symlink for runlevel 3
if not os.path.islink(rc3_link):
# this one checks for the existence of the slice initscript
# install or remove the slice inistscript, as instructed by the initscript tag
def refresh_slice_vinit(self):
- body=self.initscript
+ code=self.initscript
sliver_initscript="/vservers/%s/etc/rc.d/init.d/vinit.slice"%self.name
- if tools.replace_file_with_string(sliver_initscript,body,remove_if_empty=True,chmod=0755):
- if body:
+ if tools.replace_file_with_string(sliver_initscript,code,remove_if_empty=True,chmod=0755):
+ if code:
logger.log("vsliver_vs: %s: Installed new initscript in %s"%(self.name,sliver_initscript))
if self.is_running():
# Only need to rerun the initscript if the vserver is
if network['is_primary'] and network['bwlimit'] is not None:
DEFAULT_ALLOCATION['net_max_rate'] = network['bwlimit'] / 1000
- # Take initscripts (global) returned by API, build a hash scriptname->body
+ # Take initscripts (global) returned by API, build a hash scriptname->code
iscripts_hash = {}
if 'initscripts' not in data:
logger.log_missing_data("slivermanager.GetSlivers",'initscripts')
rec.setdefault('vref', attributes.get('vref', 'default'))
### set initscripts; set empty rec['initscript'] if not
- # if tag 'initscript_body' is set, that's what we use
- iscript_body = attributes.get('initscript_body','')
- if iscript_body:
- rec['initscript']=iscript_body
+ # if tag 'initscript_code' is set, that's what we use
+ iscode = attributes.get('initscript_code','')
+ if iscode:
+ rec['initscript']=iscode
else:
- iscript_name = attributes.get('initscript')
- if iscript_name is not None and iscript_name in iscripts_hash:
- rec['initscript'] = iscripts_hash[iscript_name]
+ isname = attributes.get('initscript')
+ if isname is not None and isname in iscripts_hash:
+ rec['initscript'] = iscripts_hash[isname]
else:
rec['initscript'] = ''