Example #1
0
def blueprints_freeze_save(socket_path, api_version, args, show_json=False):
    """Save the frozen blueprint to a TOML file

    :param socket_path: Path to the Unix socket to use for API communication
    :type socket_path: str
    :param api_version: Version of the API to talk to. eg. "0"
    :type api_version: str
    :param args: List of remaining arguments from the cmdline
    :type args: list of str
    :param show_json: Set to True to show the JSON output instead of the human readable output
    :type show_json: bool

    blueprints freeze save <blueprint,...> Save the frozen blueprint to a file, <blueprint-name>.frozen.toml.
    """
    if len(args) == 0:
        log.error("freeze save is missing the blueprint name")
        return 1

    for blueprint in argify(args):
        api_route = client.api_url(
            api_version, "/blueprints/freeze/%s?format=toml" % blueprint)
        blueprint_toml = client.get_url_raw(socket_path, api_route)
        open(frozen_toml_filename(blueprint), "w").write(blueprint_toml)

    return 0
Example #2
0
 def test_frozen_toml_filename(self):
     """Return the recipe's frozen toml filename"""
     self.assertEqual(frozen_toml_filename("http server"), "http-server.frozen.toml")