Github user wilderrodrigues commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/998#discussion_r43352356 --- Diff: systemvm/patches/debian/config/opt/cloud/bin/configure.py --- @@ -41,27 +41,37 @@ from cs.CsMonitor import CsMonitor from cs.CsLoadBalancer import CsLoadBalancer from cs.CsConfig import CsConfig +from cs.CsProcess import CsProcess class CsPassword(CsDataBag): - """ - Update the password cache - - A stupid step really as we should just rewrite the password server to - use the databag - """ - cache = "/var/cache/cloud/passwords" - + + TOKEN_FILE="/tmp/passwdsrvrtoken" + def process(self): - file = CsFile(self.cache) for item in self.dbag: if item == "id": continue - self.__update(file, item, self.dbag[item]) - file.commit() + self.__update(item, self.dbag[item]) - def __update(self, file, ip, password): - file.search("%s=" % ip, "%s=%s" % (ip, password)) + def __update(self, vm_ip, password): + token = "" + try: + tokenFile = open(self.TOKEN_FILE) + token = tokenFile.read() + except IOError: + logging.debug("File %s does not exist" % self.TOKEN_FILE) + + ips_cmd = "ip addr show | grep inet | awk '{print $2}'" + ips = CsHelper.execute(ips_cmd) + for ip in ips: + server_ip = ip.split('/')[0] + proc = CsProcess(['/opt/cloud/bin/passwd_server_ip.py', server_ip]) + if proc.find(): + update_command = 'curl --header "DomU_Request: save_password" "http://{SERVER_IP}:8080/" -F "ip={VM_IP}" -F "password={PASSWORD}" ' \ --- End diff -- Hi @bhaisaab, I will create an improvement ticket to tackle your point. After 4.6 we are planning to rewrite it in a proper way and get rid of all those things that mixes bash/python code. So, adding few lines now is not going to add to the whole picture as they will also been removed afterwards. My personal goal for 4.7/5.0, which is also the goal of my colleagues, is to rip ou the whole Python code and also the bash scripts - no longer used - from the ACS. It cannot be done right in a few lines. It would be like a drop in an ocean. Cheers, Wilder
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---