cloudmesh / client

Deprecated: Version 3 of cloudmesh is a light weight cloud client to manage virtual clusters
http://cloudmesh.github.io/client
Other
3 stars 12 forks source link

database refresh overwrites node usernames in table #263

Open badmutex opened 7 years ago

badmutex commented 7 years ago

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
laszewsk commented 7 years ago

user in cloudmesh is as far as i remember not the username of the cloud, but the user on the local systems, so it coudl ebused in a multiuser environment. I forgot what the name is for the login

but maybe as multiple people developed some of them forgot and an inconsitence was introduced.

On Mar 1, 2017, at 8:10 PM, badi notifications@github.com wrote:

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

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/cloudmesh/client/issues/263, or mute the thread https://github.com/notifications/unsubscribe-auth/AAZ8VXNX7QT_FPBQJloW8VB8timiZySLks5rhhcCgaJpZM4MQa4K.

laszewsk commented 7 years ago

i think the two terms we have are

user owner

i seemmt o have forgotten which is standing for which

On Mar 1, 2017, at 9:08 PM, Gregor von Laszewski laszewski@gmail.com wrote:

user in cloudmesh is as far as i remember not the username of the cloud, but the user on the local systems, so it coudl ebused in a multiuser environment. I forgot what the name is for the login

but maybe as multiple people developed some of them forgot and an inconsitence was introduced.

On Mar 1, 2017, at 8:10 PM, badi <notifications@github.com mailto:notifications@github.com> wrote:

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

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/cloudmesh/client/issues/263, or mute the thread https://github.com/notifications/unsubscribe-auth/AAZ8VXNX7QT_FPBQJloW8VB8timiZySLks5rhhcCgaJpZM4MQa4K.