cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhaisaab <...@git.apache.org>
Subject [GitHub] cloudstack pull request: CLOUDSTACK-8957 - VR password server feat...
Date Wed, 28 Oct 2015 16:40:29 GMT
Github user bhaisaab commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/998#discussion_r43282110
  
    --- 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 --
    
    while this works, since we are using python; we can simply make a HTTP call as well using
requests or urllib etc?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message