Example #1
0
    def clean(self):

        ce = CloudEndureManager()
        if not ce.verify_connection(
            self.cleaned_data.get('protocol'),
            self.cleaned_data.get('ip'),
            self.cleaned_data.get('username'),
            self.cleaned_data.get('port'),
            self.cleaned_data.get('password'),
        ):
            raise forms.ValidationError(
                "Unable to connect to CloudEndure Management Endpoint using the parameters provided ")

        return self.cleaned_data
Example #2
0
def verify_cloudendure_connection(request):
    cloudendure = CloudEndureManager()

    if cloudendure.verify_connection():
        msg = format_html(
            '<p style="color: green">Successfully connected to CloudEndure</p>'
        )
    else:
        msg = format_html(
            '<p style="color: red">Could not make a connection to CloudEndure</p>'
        )

    return {
        'title': 'Verify connection to CloudEndure Endpoint',
        'content': msg,
        'submit': None,
        'cancel': "OK",
    }