Modified files from cloudbase-init added
This commit is contained in:
parent
485ec41d1e
commit
f7c8d4a726
10
Deployment/cloudbase-init/config/cloudbase-init.conf
Normal file
10
Deployment/cloudbase-init/config/cloudbase-init.conf
Normal file
@ -0,0 +1,10 @@
|
||||
[DEFAULT]
|
||||
username=Admin
|
||||
groups=Administrators
|
||||
inject_user_password=false
|
||||
network_adapters=
|
||||
config_drive_raw_hdd=false
|
||||
config_drive_cdrom=false
|
||||
verbose=true
|
||||
logdir=C:\Program Files (x86)\Cloudbase Solutions\Cloudbase-Init\log\
|
||||
logfile=cloudbase-init.log
|
37
Deployment/cloudbase-init/plugins/setagentconfig.py
Normal file
37
Deployment/cloudbase-init/plugins/setagentconfig.py
Normal file
@ -0,0 +1,37 @@
|
||||
import codecs
|
||||
|
||||
from cloudbaseinit.osutils.factory import *
|
||||
from cloudbaseinit.plugins.base import *
|
||||
from cloudbaseinit.openstack.common import log as logging
|
||||
|
||||
opts = [
|
||||
cfg.StrOpt('agent_config_file', default='C:\\Keero\\Agent\\WindowsAgent.exe.config', help='')
|
||||
]
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.register_opts(opts)
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class SetHostNamePlugin(BasePlugin):
|
||||
def execute(self, service):
|
||||
meta_data = service.get_meta_data('openstack')
|
||||
if 'meta' not in meta_data:
|
||||
LOG.debug("Section 'meta' not found in metadata")
|
||||
return False
|
||||
|
||||
if 'agent_config_xml' not in meta_data['meta']:
|
||||
LOG.debug("Config for agent not found in metadata section")
|
||||
return False
|
||||
|
||||
try:
|
||||
configFile=codecs.open(CONF.agent_config_file, encoding='utf-8', mode='w+')
|
||||
configFile.write(meta_data['meta']['agent_config_xml'])
|
||||
configFile.close()
|
||||
except:
|
||||
LOG.error("Unable to update agent file.")
|
||||
return False
|
||||
|
||||
return True
|
||||
|
20
Deployment/cloudbase-init/plugins/sethostname.py
Normal file
20
Deployment/cloudbase-init/plugins/sethostname.py
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
from cloudbaseinit.osutils.factory import *
|
||||
from cloudbaseinit.plugins.base import *
|
||||
from cloudbaseinit.openstack.common import log as logging
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class SetHostNamePlugin(BasePlugin):
|
||||
def execute(self, service):
|
||||
meta_data = service.get_meta_data('openstack')
|
||||
if 'name' not in meta_data:
|
||||
LOG.debug('Name not found in metadata')
|
||||
return False
|
||||
|
||||
osutils = OSUtilsFactory().get_os_utils()
|
||||
|
||||
new_host_name = meta_data['name'].replace('.', '-')
|
||||
return osutils.set_host_name(new_host_name)
|
||||
|
Loading…
x
Reference in New Issue
Block a user