示例#1
0
    def form_valid(self, form):

        create_ssh_config(
            name=form.cleaned_data.get('name'),
            private_key_text=form.cleaned_data.get('private_key'),
            public_key_text=form.cleaned_data.get('public_key'),
            remote_user=form.cleaned_data.get('remote_user'),
        )

        return super(SSHKeysCreate, self).form_valid(form)
示例#2
0
    def post(self, *args, **kwargs):
        """Create the SSH file & then return the normal get method..."""

        existing_ssh = models.SSHConfig.objects.all()

        if existing_ssh.exists():
            return self.get_view()

        remote_user = self.request.POST.get('remote_user', 'root')

        create_ssh_config(remote_user=remote_user)

        return self.get_view()
示例#3
0
    def test_create_ssh_config(self):
        ssh_config = create_ssh_config(remote_user='******')

        self.assertEquals('test_user', ssh_config.remote_user)
示例#4
0
    def _create_ssh_config(self):

        self.ssh_config = create_ssh_config()
示例#5
0
    def test_create_ssh_config(self):
        ssh_config = create_ssh_config(remote_user='******')

        self.assertEquals('test_user', ssh_config.remote_user)
示例#6
0
    def _create_ssh_config(self):

        self.ssh_config = create_ssh_config()