예제 #1
0
Test the heat-translator translation from command line as:
#heat-translator
  --template-file=<path to the YAML template>
  --template-type=<type of template e.g. tosca>
  --parameters="purpose=test"
Takes three user arguments,
1. Path to the file that needs to be translated (required)
2. type of translation (e.g. tosca) (optional)
3. Input parameters (optional)

In order to use heat-translator to only validate template,
without actual translation, pass --validate-only=true along with
other required arguments.

"""
conf_file = ConfigProvider.get_translator_logging_file()
try:
    logging.config.fileConfig(conf_file)
except Exception:
    pass
log = logging.getLogger("heat-translator")


class TranslatorShell(object):

    SUPPORTED_TYPES = ['tosca']
    TOSCA_CSAR_META_DIR = "TOSCA-Metadata"

    def get_parser(self, argv):
        parser = argparse.ArgumentParser(prog="heat-translator")
예제 #2
0
Test the heat-translator translation from command line as:
#heat-translator
  --template-file=<path to the YAML template>
  --template-type=<type of template e.g. tosca>
  --parameters="purpose=test"
Takes three user arguments,
1. type of translation (e.g. tosca) (required)
2. Path to the file that needs to be translated (required)
3. Input parameters (optional)

In order to use heat-translator to only validate template,
without actual translation, pass --validate-only=true along with
other required arguments.

"""
conf_file = ConfigProvider.get_translator_logging_file()
logging.config.fileConfig(conf_file)
log = logging.getLogger("heat-translator")


class TranslatorShell(object):

    SUPPORTED_TYPES = ['tosca']

    def _validate(self, args):
        if len(args) < 2:
            msg = _("The program requires minimum two arguments. "
                    "Please refer to the usage documentation.")
            log.error(msg)
            raise ValueError(msg)
        if "--template-file=" not in args[0]: