Changeset - 6c65b997bea3
[Not reviewed]
0 2 0
Branko Majic (branko) - 6 years ago 2018-03-18 11:21:25
branko@majic.rs
Noticket: Fixed bug with wrong output message when server command refuses to issue certificate for existing entity:

- Make sure to use the entity name in the output, and not a static
string.
2 files changed with 2 insertions and 1 deletions:
0 comments (0 inline, 0 general)
gimmecert/commands.py
Show inline comments
 
@@ -126,7 +126,7 @@ def server(stdout, stderr, project_directory, entity_name, extra_dns_names):
 
        return ExitCode.ERROR_NOT_INITIALISED
 

	
 
    if os.path.exists(private_key_path) or os.path.exists(certificate_path):
 
        print("Refusing to overwrite existing data. Certificate has already been issued for server myserver.", file=stderr)
 
        print("Refusing to overwrite existing data. Certificate has already been issued for server %s." % entity_name, file=stderr)
 
        return ExitCode.ERROR_CERTIFICATE_ALREADY_ISSUED
 

	
 
    print("""Server certificate issued.\n
tests/test_commands.py
Show inline comments
 
@@ -217,6 +217,7 @@ def test_server_errors_out_if_certificate_already_issued(tmpdir):
 

	
 
    assert status_code == gimmecert.commands.ExitCode.ERROR_CERTIFICATE_ALREADY_ISSUED
 
    assert "already been issued" in stderr
 
    assert "server myserver" in stderr
 
    assert stdout == ""
 
    assert tmpdir.join('.gimmecert', 'server', 'myserver.key.pem').read() == existing_private_key
 
    assert tmpdir.join('.gimmecert', 'server', 'myserver.cert.pem').read() == certificate
0 comments (0 inline, 0 general)