コード例 #1
0
 def test_master_file_overwrite(self):
     """Test the case where the master password file already exists,
     but contains a stale value. Should be overwritten during the deployment
     with the current value.
     """
     dd = self.dd; isf = self.isf; master_pw_file = self.master_pw_file
     input_pw_file = self.input_pw_file; assertTrue=self.assertTrue
     svcctl_exe = self.svcctl_exe
     
     with open(master_pw_file, "w") as f:
         f.write("test3") # bogus old file
     with open(input_pw_file, "w") as f:
         f.write("test4")
     opts="--generate-random-passwords --master-password-file=%s" % \
           input_pw_file
     logger.info("Testing deployer with options %s" % opts)
     rc = tc.deployer(dd, isf, opts=opts)
     assertTrue(rc==0, "Deployer failed, return code was %d" % rc)
     assertTrue(os.path.exists(master_pw_file),
                "Deployer ran, but master password file is not at %s" %
                master_pw_file)
     with open(master_pw_file, "r") as f:
         new_pw_data = f.read().rstrip()
     self.assertEqual("test4", new_pw_data,
                      "Password file %s should have been overwritten, but wasn't"%
                      master_pw_file)
     rc = tc.shell("%s status" % svcctl_exe)
     assertTrue(rc==0, "svcctl failed, return code was %d" % rc)
コード例 #2
0
 def test_master_file_generation(self):
     dd = self.dd; isf = self.isf; master_pw_file = self.master_pw_file
     input_pw_file = self.input_pw_file; assertTrue=self.assertTrue
     svcctl_exe = self.svcctl_exe
     
     with open(self.input_pw_file, "w") as f:
         f.write("test")
     opts="--generate-random-passwords --master-password-file=%s" % \
           input_pw_file
     logger.info("Testing deployer with options %s" % opts)
     rc = tc.deployer(dd, isf, opts=opts)
     assertTrue(rc==0, "Deployer failed, return code was %d" % rc)
     assertTrue(os.path.exists(master_pw_file),
                "Deployer ran, but did not generate master password file %s" %
                master_pw_file)
     rc = tc.shell("%s status" % svcctl_exe)
     _assert(rc==0, "svcctl failed, return code was %d" % rc)
コード例 #3
0
 def test_suppress_master_password_file(self):
     dd = self.dd; isf = self.isf; master_pw_file = self.master_pw_file
     input_pw_file = self.input_pw_file; assertTrue=self.assertTrue
     svcctl_exe = self.svcctl_exe
     
     with open(input_pw_file, "w") as f:
         f.write("test2")
     opts="--generate-random-passwords --suppress-master-password-file --master-password-file=%s" % \
           input_pw_file
     logger.info("Testing deployer with options %s" % opts)
     rc = tc.deployer(dd, isf, opts=opts)
     assertTrue(rc==0, "Deployer failed, return code was %d" % rc)
     assertTrue(not os.path.exists(master_pw_file),
            "Deployer ran, but generated master password file %s even when --suppress-master-password-file was set" %
            master_pw_file)
     rc = tc.shell("%s --master-password-file=%s status" %
                   (svcctl_exe, input_pw_file))
     assertTrue(rc==0, "svcctl failed, return code was %d" % rc)
     assertTrue(not os.path.exists(master_pw_file),
             "svcctl seems to have created a master password file at %s" %
             master_pw_file)
コード例 #4
0
 def test_master_file_use(self):
     """If the master password file already exists, it should be
     used by the deployer.
     """
     dd = self.dd; isf = self.isf; master_pw_file = self.master_pw_file
     assertTrue=self.assertTrue
     svcctl_exe = self.svcctl_exe
     
     with open(master_pw_file, "w") as f:
         f.write("test3")
     opts="--generate-random-passwords"
     logger.info("Testing deployer with options %s" % opts)    
     rc = tc.deployer(dd, isf, opts=opts)
     assertTrue(rc==0, "Deployer failed, return code was %d" % rc)
     assertTrue(os.path.exists(master_pw_file),
                "Deployer ran, but master password file is not at %s" %
                master_pw_file)
     rc = tc.shell("%s status" % svcctl_exe)
     assertTrue(rc==0, "svcctl failed, return code was %d" % rc)
     assertTrue(os.path.exists(master_pw_file),
                "after svcctl run, no longer a master password file at %s" %
                master_pw_file)