forked from guohongze/adminset
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2,139 changed files
with
218,539 additions
and
233,518 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.svn/ | ||
.idea/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from django.contrib import admin |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from __future__ import unicode_literals | ||
|
||
from django.apps import AppConfig | ||
|
||
|
||
class AnsibleConfig(AppConfig): | ||
name = 'ansible' |
Empty file.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from __future__ import unicode_literals | ||
|
||
from django.db import models | ||
|
||
# Create your models here. |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.test import TestCase | ||
|
||
# Create your tests here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#! /usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
from django.conf.urls import url, include | ||
from . import views | ||
|
||
app_name = 'cmdb' | ||
urlpatterns = [ | ||
url(r'^$', views.ansible, name='ansible'), | ||
url(r'^exec', views.ansiblexe, name='exec'), | ||
] |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
from subprocess import Popen, PIPE | ||
from cmdb.models import Host, HostGroup | ||
from django.shortcuts import render_to_response, redirect | ||
from django.http import HttpResponse | ||
|
||
|
||
def ansible(request): | ||
host_list = Host.objects.all() | ||
hostgroup = HostGroup.objects.all() | ||
return render_to_response('ansible.html',locals()) | ||
|
||
|
||
def ansiblexe(request): | ||
if request.method == 'POST': | ||
host1 = request.POST.getlist('mserver', []) | ||
group = request.POST.getlist('mgroup', []) | ||
playbook = request.POST.getlist('mplaybook', []) | ||
command = request.POST.getlist('mcommand', []) | ||
for h in host1: | ||
print h | ||
print type(group) | ||
print type(playbook) | ||
print type(command) | ||
return HttpResponse("ok") | ||
# if host: | ||
# if playbook: | ||
# for h in host: | ||
# print h | ||
# f = open('svn_install.yml', 'r+') | ||
# flist = f.readlines() | ||
# flist[0] = '- hosts: '+h+'\n' | ||
# f = open('svn_install.yml', 'w+') | ||
# f.writelines(flist) | ||
# f.close() | ||
# cmd = "ansible-playbook"+" "+playbook | ||
# p = Popen(cmd, stdout=PIPE, shell=True) | ||
# data = p.communicate() | ||
# return data | ||
# else: | ||
# for h in host: | ||
# cmd = "ansible" + " " + h + "-a" + command | ||
# p = Popen(cmd, stdout=PIPE, shell=True) | ||
# data = p.communicate() | ||
# return data | ||
# else: | ||
# if group: | ||
# for g in group: | ||
# f = open('svn_install.yml', 'r+') | ||
# flist = f.readlines() | ||
# flist[0] = '- hosts: '+g+'\n' | ||
# f = open('svn_install.yml', 'w+') | ||
# f.writelines(flist) | ||
# f.close | ||
# cmd = "ansible-playbook"+" "+playbook | ||
# p = Popen(cmd, stdout=PIPE, shell=True) | ||
# data = p.communicate() | ||
# return data | ||
# else: | ||
# for g in group: | ||
# cmd = "ansible" + " " + h + "-a" + command | ||
# p = Popen(cmd, stdout=PIPE, shell=True) | ||
# data = p.communicate() | ||
# return data | ||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.9.8 on 2017-02-03 14:11 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('cmdb', '0009_auto_20170128_2350'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterModelOptions( | ||
name='idc', | ||
options={'verbose_name': '\u6570\u636e\u4e2d\u5fc3', 'verbose_name_plural': '\u6570\u636e\u4e2d\u5fc3'}, | ||
), | ||
migrations.AlterField( | ||
model_name='host', | ||
name='cpu_model', | ||
field=models.CharField(max_length=100, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='host', | ||
name='os', | ||
field=models.CharField(max_length=50, null=True, verbose_name='\u64cd\u4f5c\u7cfb\u7edf'), | ||
), | ||
migrations.AlterField( | ||
model_name='idc', | ||
name='address', | ||
field=models.CharField(max_length=100, null=True), | ||
), | ||
] |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from django.contrib import admin | ||
from .models import navi | ||
|
||
class NaviAdmin(admin.ModelAdmin): | ||
list_display = [ | ||
'name', | ||
'url', | ||
] | ||
|
||
|
||
admin.site.register(navi, NaviAdmin) | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from __future__ import unicode_literals | ||
|
||
from django.apps import AppConfig | ||
|
||
|
||
class NaviConfig(AppConfig): | ||
name = 'navi' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.9.8 on 2017-02-03 14:11 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='navi', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('name', models.CharField(max_length=50, null=True)), | ||
('img', models.CharField(max_length=50, null=True)), | ||
('url', models.URLField()), | ||
], | ||
), | ||
] |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.9.8 on 2017-02-10 01:46 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('navi', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.RenameField( | ||
model_name='navi', | ||
old_name='img', | ||
new_name='description', | ||
), | ||
] |
Binary file not shown.
Empty file.
Binary file not shown.
Oops, something went wrong.