Skip to content

database refresh overwrites node usernames in table #263

@badmutex

Description

@badmutex

I don't have time to properly fix this now so am marking here for future reference.

CloudmeshDatabase.refresh causes the username field (and perhaps others) to be overwritten.
I noticed this when trying to deploy hadoop to chameleon which uses cc instead of ubuntu as the user. The deployment autodetects the node usernames but deployment was failing due to incorrect username. I traced the error to the refresh() method by stepping through the code and monitoring the table.

The relevant code snipped is below.

                # get provider for specific cloud
                provider = CloudProvider(name).provider

                elements = cls.find(category=name, kind=kind, output='dict')

                current_elements = {}
                if elements:
                    for element in elements:
                        current_elements[element["name"]] = element

                    # pprint(current_elements)

                # if purge:
                #     cls.clear(kind=kind, category=name)

                elements = provider.list(kind, name)

                for element in list(elements.values()):
                    element["uuid"] = element['id']
                    element['type'] = 'string'
                    element["category"] = name

                    # element["user"] = user
                    element["kind"] = kind
                    element["provider"] = provider.cloud_type
                    if current_elements is not None:
                        for index in current_elements:
                            current = current_elements[index]
                            for attribute in ["username", "image", "flavor", "group"]:
                                if attribute in current and current[attribute] is not None:
                                    element[attribute] = current[attribute]
                    # print ("CCC", index, element["name"], element["flavor"])
                    cls.add(element)

                return True

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions