[
https://issues.apache.org/jira/browse/CLOUDSTACK-8957?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14978855#comment-14978855
]
ASF GitHub Bot commented on CLOUDSTACK-8957:
--------------------------------------------
Github user wilderrodrigues commented on a diff in the pull request:
https://github.com/apache/cloudstack/pull/998#discussion_r43290720
--- 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 --
Good point, @bhaisaab .
I don't have the energy to update it now, but will do it tomorrow. I just
used the same stuff we had in the previous passwd bash file, but it makes more
sense to Pythonise the whole thing. :)
Cheers,
Wilder
> VR password server broken
> -------------------------
>
> Key: CLOUDSTACK-8957
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-8957
> Project: CloudStack
> Issue Type: Bug
> Security Level: Public(Anyone can view this level - this is the
> default.)
> Components: Virtual Router
> Affects Versions: 4.6.0
> Environment: ACS 4.6.0 snapshot, CentOS6 HVs and mgmt
> Reporter: Nux
> Assignee: Wilder Rodrigues
> Priority: Blocker
>
> Hello,
> When deploying instances from password enabled templates, the instances do
> not get the generated passwords.
> The VR logs show something like this:
> 'Oct 15 17:12:27 r-4-VM passwd_server_ip.py: serve_password: requested
> password not found for 10.1.1.33'
> In /var/cache/cloud the "passwords-10.1.1.1" is empty, but "passwords" is
> not, I can see the passwords there.
> Symlinking "passwords-10.1.1.1" to "passwords" and restarting the
> passwd_server_ip script gets the feature working again, though I am not sure
> how correct this approach is.
>
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)