Add more enpoints mainly for tests

Partially implements: blueprint image-based-provisioning
Change-Id: I8c2d2abc38068b6da59243d73d545dad62097aff
This commit is contained in:
Alexander Gordeev 2014-08-21 20:29:49 +04:00
parent f00be1a3a6
commit f56cde93e0
3 changed files with 56 additions and 54 deletions

View File

@ -12,10 +12,59 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
import sys
def main():
pass
from oslo.config import cfg
from fuel_agent import manager as manager
from fuel_agent.openstack.common import log
from fuel_agent import version
opts = [
cfg.StrOpt(
'provision_data_file',
default='/tmp/provision.json',
help='Provision data file'
),
]
CONF = cfg.CONF
CONF.register_opts(opts)
def provision():
main(['do_provisioning'])
def partition():
main(['do_parsing', 'do_partitioning'])
def copyimage():
main(['do_parsing', 'do_copyimage'])
def configdrive():
main(['do_parsing', 'do_configdrive'])
def bootloader():
main(['do_parsing', 'do_bootloader'])
def main(actions=None):
CONF(sys.argv[1:], project='fuel-agent',
version=version.version_info.release_string())
log.setup('fuel-agent')
with open(CONF.provision_data_file) as f:
data = json.load(f)
mgr = manager.Manager(data)
if actions:
for action in actions:
getattr(mgr, action)()
if __name__ == '__main__':
main()

View File

@ -1,49 +0,0 @@
# Copyright 2014 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import json
import sys
from oslo.config import cfg
from fuel_agent import manager as manager
from fuel_agent.openstack.common import log
from fuel_agent import version
opts = [
cfg.StrOpt(
'provision_data_file',
default='/tmp/provision.json',
help='Provision data file'
),
]
CONF = cfg.CONF
CONF.register_opts(opts)
def main():
CONF(sys.argv[1:], project='fuel-agent',
version=version.version_info.release_string())
log.setup('fuel-agent')
with open(CONF.provision_data_file) as f:
data = json.load(f)
provision_manager = manager.Manager(data)
provision_manager.do_provisioning()
if __name__ == '__main__':
main()

View File

@ -14,9 +14,11 @@ packages =
[entry_points]
console_scripts =
agent_new = fuel_agent.cmd.agent:main
provision = fuel_agent.cmd.provision:main
partition = fuel_agent.cmd.partition:main
provision = fuel_agent.cmd.agent:provision
partition = fuel_agent.cmd.agent:partition
configdrive = fuel_agent.cmd.agent:configdrive
copyimage = fuel_agent.cmd.agent:copyimage
bootloader = fuel_agent.cmd.agent:bootloader
fuel_agent.drivers =
nailgun = fuel_agent.drivers.nailgun:Nailgun