Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
agent
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
7
Merge Requests
0
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
dd9ed14c
authored
Sep 01, 2014
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix mount_store
parent
05b2e754
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
10 deletions
+19
-10
agent.py
+5
-9
notify.py
+14
-1
No files found.
agent.py
View file @
dd9ed14c
...
@@ -41,12 +41,6 @@ mount_template_linux = (
...
@@ -41,12 +41,6 @@ mount_template_linux = (
'//
%(host)
s/
%(username)
s
%(dir)
s cifs username=
%(username)
s'
'//
%(host)
s/
%(username)
s
%(dir)
s cifs username=
%(username)
s'
',password=
%(password)
s,iocharset=utf8,uid=cloud 0 0
\n
'
)
',password=
%(password)
s,iocharset=utf8,uid=cloud 0 0
\n
'
)
mount_template_windows
=
(
'net use * /delete /yes
\r\n
'
'timeout 5
\r\n
'
'net use z:
\\
%(host)
s
\\
%(username)
s "
%(password)
s" '
'/user:
%(username)
s
\r\n
'
)
system
=
platform
.
system
()
system
=
platform
.
system
()
distros
=
{
'Scientific Linux'
:
'rhel'
,
distros
=
{
'Scientific Linux'
:
'rhel'
,
...
@@ -171,9 +165,11 @@ class Context(object):
...
@@ -171,9 +165,11 @@ class Context(object):
subprocess
.
call
(
'mount -a'
,
shell
=
True
)
subprocess
.
call
(
'mount -a'
,
shell
=
True
)
elif
system
==
'Windows'
:
elif
system
==
'Windows'
:
with
open
(
r'c:\Windows\System32\Repl\Import\Scripts\%s.bat'
import
notify
%
username
,
'w'
)
as
f
:
url
=
'cifs://
%
s:
%
s@
%
s/
%
s'
%
(
username
,
password
,
host
,
username
)
f
.
write
(
mount_template_windows
%
data
)
for
c
in
notify
.
clients
:
logger
.
debug
(
"sending url
%
s to client
%
s"
,
url
,
unicode
(
c
))
c
.
sendLine
(
url
.
encode
())
@staticmethod
@staticmethod
def
get_keys
():
def
get_keys
():
...
...
notify.py
View file @
dd9ed14c
...
@@ -14,6 +14,7 @@ import os
...
@@ -14,6 +14,7 @@ import os
import
platform
import
platform
import
subprocess
import
subprocess
import
urllib2
import
urllib2
from
urlparse
import
urlsplit
logger
=
logging
.
getLogger
()
logger
=
logging
.
getLogger
()
logger
.
debug
(
"notify imported"
)
logger
.
debug
(
"notify imported"
)
...
@@ -127,6 +128,15 @@ def open_in_browser(url):
...
@@ -127,6 +128,15 @@ def open_in_browser(url):
webbrowser
.
open
(
url
,
new
=
2
,
autoraise
=
True
)
webbrowser
.
open
(
url
,
new
=
2
,
autoraise
=
True
)
def
mount_smb
(
url
):
data
=
urlsplit
(
url
)
share
=
data
.
path
.
lstrip
(
'/'
)
subprocess
.
call
((
'net'
,
'use'
,
'Z:'
,
'/delete'
))
subprocess
.
check_output
((
'net'
,
'use'
,
'Z:'
,
r'\\
%
s\%s'
%
(
data
.
hostname
,
share
),
data
.
password
,
'/user:
%
s'
%
data
.
username
,
'/PERSISTENT:YES'
))
def
file_already_exists
(
name
,
mode
=
0
o644
):
def
file_already_exists
(
name
,
mode
=
0
o644
):
"""Return whether file already exists, create it if not.
"""Return whether file already exists, create it if not.
...
@@ -201,7 +211,10 @@ if win:
...
@@ -201,7 +211,10 @@ if win:
def
lineReceived
(
self
,
line
):
def
lineReceived
(
self
,
line
):
print
"received"
,
line
print
"received"
,
line
open_in_browser
(
line
)
if
line
.
startswith
(
'cifs://'
):
mount_smb
(
line
)
else
:
open_in_browser
(
line
)
class
SubFactory
(
protocol
.
ReconnectingClientFactory
):
class
SubFactory
(
protocol
.
ReconnectingClientFactory
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment