def do_cli(args, template_file, stack_name):
    args = args + ("--stack-name", stack_name)

    try:
        execute_command("deploy", args, template_file=template_file)
    except OSError as ex:
        raise UserException(str(ex))
Exemplo n.º 2
0
 def test_command_must_exit_with_status_code(self, find_executable_mock,
                                             check_call_mock, exit_mock):
     find_executable_mock.return_value = "mycmd"
     check_call_mock.side_effect = CalledProcessError(2, "Error")
     exit_mock.return_value = True
     execute_command("command", self.args, None)
     exit_mock.assert_called_with(2)
Exemplo n.º 3
0
def do_cli(args, template_file, s3_bucket):
    args = args + ('--s3-bucket', s3_bucket)

    try:
        execute_command("package", args, template_file)
    except OSError as ex:
        raise UserException(str(ex))
Exemplo n.º 4
0
 def test_command_must_exit_with_status_code(self, platform_system_mock,
                                             check_call_mock, exit_mock):
     platform_system_mock.return_value = "Any"
     check_call_mock.side_effect = CalledProcessError(2, "Error")
     exit_mock.return_value = True
     execute_command("command", self.args)
     exit_mock.assert_called_with(2)
Exemplo n.º 5
0
def do_cli(args, template_file, s3_bucket):
    args = args + ('--s3-bucket', s3_bucket)

    try:
        execute_command("package", args, template_file)
    except OSError as ex:
        raise UserException(str(ex))
Exemplo n.º 6
0
 def test_command_must_call_aws_windows(self, platform_system_mock,
                                        check_call_mock):
     platform_system_mock.return_value = "Windows"
     check_call_mock.return_value = True
     execute_command("command", self.args)
     check_call_mock.assert_called_with(
         ["aws.cmd", "cloudformation", "command"] + list(self.args))
Exemplo n.º 7
0
def do_cli(args, template_file, stack_name):
    args = args + ('--stack-name', stack_name)

    try:
        execute_command("deploy", args, template_file=template_file)
    except OSError as ex:
        raise UserException(str(ex))
    def test_must_add_template_file(self, find_executable_mock, check_call_mock):
        find_executable_mock.return_value = "mycmd"
        check_call_mock.return_value = True
        execute_command("command", self.args, "/path/to/template")

        check_call_mock.assert_called_with(["mycmd", "cloudformation", "command"] +
                                           ["--arg1", "value1", "different args", "more",
                                            "--template-file", "/path/to/template"], env=ANY)
    def test_must_add_template_file(self, find_executable_mock, check_call_mock):
        find_executable_mock.return_value = "mycmd"
        check_call_mock.return_value = True
        execute_command("command", self.args, "/path/to/template")

        check_call_mock.assert_called_with(["mycmd", "cloudformation", "command"] +
                                           ["--arg1", "value1", "different args", "more",
                                            "--template-file", "/path/to/template"])
    def test_must_not_set_exec_env(self, global_config_mock, find_executable_mock, check_call_mock):
        global_config_mock.return_value.telemetry_enabled = False

        # Expected to pass just a copy of the environment variables without modification
        expected_env = os.environ.copy()

        find_executable_mock.return_value = "mycmd"
        check_call_mock.return_value = True
        execute_command("command", self.args, "/path/to/template")

        check_call_mock.assert_called()
        kwargs = check_call_mock.call_args[1]
        self.assertIn("env", kwargs)
        self.assertEquals(kwargs["env"], expected_env)
    def test_must_add_sam_cli_info_to_execution_env_var_if_telemetry_is_on(self, global_config_mock,
                                                                           find_executable_mock, check_call_mock):
        installation_id = "testtest"
        global_config_mock.return_value.installation_id = installation_id
        global_config_mock.return_value.telemetry_enabled = True

        expected_env = os.environ.copy()
        expected_env["AWS_EXECUTION_ENV"] = "SAM-" + installation_id

        find_executable_mock.return_value = "mycmd"
        check_call_mock.return_value = True
        execute_command("command", self.args, "/path/to/template")

        check_call_mock.assert_called()
        kwargs = check_call_mock.call_args[1]
        self.assertIn("env", kwargs)
        self.assertEquals(kwargs["env"], expected_env)
Exemplo n.º 12
0
def do_cli(args):
    execute_command("deploy", args, template_file=None)
Exemplo n.º 13
0
def do_cli(args):
    execute_command("deploy", args)
Exemplo n.º 14
0
def do_cli(args, template_file):
    execute_command("package", args, template_file)
 def test_command_must_exit_with_status_code(self, find_executable_mock, check_call_mock, exit_mock):
     find_executable_mock.return_value = "mycmd"
     check_call_mock.side_effect = CalledProcessError(2, "Error")
     exit_mock.return_value = True
     execute_command("command", self.args, None)
     exit_mock.assert_called_with(2)
Exemplo n.º 16
0
def do_cli(args, template_file):
    try:
        execute_command("package", args, template_file)
    except OSError as ex:
        raise UserException(str(ex))
Exemplo n.º 17
0
def do_cli(args):
    execute_command("package", args)
Exemplo n.º 18
0
def do_cli(args):
    try:
        execute_command("deploy", args, template_file=None)
    except OSError as ex:
        raise UserException(str(ex))