flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tillrohrmann <...@git.apache.org>
Subject [GitHub] flink pull request #5416: [FLINK-8562] [Security] Fix YARNSessionFIFOSecured...
Date Tue, 20 Mar 2018 09:46:29 GMT
Github user tillrohrmann commented on a diff in the pull request:

    https://github.com/apache/flink/pull/5416#discussion_r175704459
  
    --- Diff: flink-yarn-tests/src/test/java/org/apache/flink/yarn/YarnTestBase.java ---
    @@ -465,27 +514,23 @@ private static void start(YarnConfiguration conf, String principal,
String keyta
     
     			File flinkConfDirPath = findFile(flinkDistRootDir, new ContainsName(new String[]{"flink-conf.yaml"}));
     			Assert.assertNotNull(flinkConfDirPath);
    +			org.apache.flink.configuration.Configuration flinkCfg =
    +					new org.apache.flink.configuration.Configuration();
     
     			if (!StringUtils.isBlank(principal) && !StringUtils.isBlank(keytab)) {
    +
     				//copy conf dir to test temporary workspace location
     				tempConfPathForSecureRun = tmp.newFolder("conf");
     
     				String confDirPath = flinkConfDirPath.getParentFile().getAbsolutePath();
     				FileUtils.copyDirectory(new File(confDirPath), tempConfPathForSecureRun);
     
    -				try (FileWriter fw = new FileWriter(new File(tempConfPathForSecureRun, "flink-conf.yaml"),
true);
    -					BufferedWriter bw = new BufferedWriter(fw);
    -					PrintWriter out = new PrintWriter(bw)) {
    -
    -					LOG.info("writing keytab: " + keytab + " and principal: " + principal + " to config
file");
    -					out.println("");
    -					out.println("#Security Configurations Auto Populated ");
    -					out.println(SecurityOptions.KERBEROS_LOGIN_KEYTAB.key() + ": " + keytab);
    -					out.println(SecurityOptions.KERBEROS_LOGIN_PRINCIPAL.key() + ": " + principal);
    -					out.println("");
    -				} catch (IOException e) {
    -					throw new RuntimeException("Exception occured while trying to append the security
configurations.", e);
    -				}
    +				flinkCfg.setString(SecurityOptions.KERBEROS_LOGIN_KEYTAB.key(), keytab);
    +				flinkCfg.setString(SecurityOptions.KERBEROS_LOGIN_PRINCIPAL.key(), principal);
    +				flinkCfg.setString(CoreOptions.MODE.key(), OLD_MODE);
    --- End diff --
    
    I think we should assign the `Configuration` to `flinkConfiguration`, then we don't have
to read it in from disk again.


---

Mime
View raw message