Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
19
Merge Requests
19
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos.core
Commits
c2a99c9e
Commit
c2a99c9e
authored
Mar 27, 2013
by
Jondy Zhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for cygwin.
parent
5098f660
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
5 deletions
+20
-5
slapos/format.py
slapos/format.py
+17
-4
slapos/grid/slapgrid.py
slapos/grid/slapgrid.py
+1
-1
slapos/grid/utils.py
slapos/grid/utils.py
+2
-0
No files found.
slapos/format.py
View file @
c2a99c9e
...
@@ -523,10 +523,11 @@ class User(object):
...
@@ -523,10 +523,11 @@ class User(object):
# XXX: This method shall be no-op in case if all is correctly setup
# XXX: This method shall be no-op in case if all is correctly setup
# This method shall check if all is correctly done
# This method shall check if all is correctly done
# This method shall not reset groups, just add them
# This method shall not reset groups, just add them
grpname
=
'grp_'
+
self
.
name
if
sys
.
platform
==
'cygwin'
else
self
.
name
try
:
try
:
grp
.
getgrnam
(
self
.
name
)
grp
.
getgrnam
(
grp
name
)
except
KeyError
:
except
KeyError
:
callAndRead
([
'groupadd'
,
self
.
name
])
callAndRead
([
'groupadd'
,
grp
name
])
user_parameter_list
=
[
'-d'
,
self
.
path
,
'-g'
,
self
.
name
,
'-s'
,
user_parameter_list
=
[
'-d'
,
self
.
path
,
'-g'
,
self
.
name
,
'-s'
,
'/bin/false'
]
'/bin/false'
]
...
@@ -697,6 +698,9 @@ class Interface(object):
...
@@ -697,6 +698,9 @@ class Interface(object):
except
KeyError
:
except
KeyError
:
raise
ValueError
(
"%s must have at least one IPv6 address assigned"
%
\
raise
ValueError
(
"%s must have at least one IPv6 address assigned"
%
\
interface_name
)
interface_name
)
if
sys
.
platform
==
'cygwin'
:
for
q
in
address_list
:
q
.
setdefault
(
'netmask'
,
'FFFF:FFFF:FFFF:FFFF::'
)
# XXX: Missing implementation of Unique Local IPv6 Unicast Addresses as
# XXX: Missing implementation of Unique Local IPv6 Unicast Addresses as
# defined in http://www.rfc-editor.org/rfc/rfc4193.txt
# defined in http://www.rfc-editor.org/rfc/rfc4193.txt
# XXX: XXX: XXX: IT IS DISALLOWED TO IMPLEMENT link-local addresses as
# XXX: XXX: XXX: IT IS DISALLOWED TO IMPLEMENT link-local addresses as
...
@@ -811,7 +815,8 @@ class Interface(object):
...
@@ -811,7 +815,8 @@ class Interface(object):
def
addIPv4LocalAddress
(
self
,
addr
=
None
):
def
addIPv4LocalAddress
(
self
,
addr
=
None
):
"""Adds local IPv4 address in ipv4_local_network"""
"""Adds local IPv4 address in ipv4_local_network"""
netmask
=
'255.255.255.255'
netmask
=
'255.255.255.254'
if
sys
.
platform
==
'cygwin'
\
else
'255.255.255.255'
local_address_list
=
self
.
getIPv4LocalAddressList
()
local_address_list
=
self
.
getIPv4LocalAddressList
()
if
addr
is
None
:
if
addr
is
None
:
return
self
.
_generateRandomIPv4Address
(
netmask
)
return
self
.
_generateRandomIPv4Address
(
netmask
)
...
@@ -1140,7 +1145,7 @@ class Config(object):
...
@@ -1140,7 +1145,7 @@ class Config(object):
except
ValueError
:
except
ValueError
:
pass
pass
except
OSError
:
except
OSError
:
missing_binary_list
.
append
(
b
)
missing_binary_list
.
append
(
b
[
0
]
)
if
missing_binary_list
:
if
missing_binary_list
:
raise
UsageError
(
'Some required binaries are missing or not '
raise
UsageError
(
'Some required binaries are missing or not '
'functional: %s'
%
(
','
.
join
(
missing_binary_list
),
))
'functional: %s'
%
(
','
.
join
(
missing_binary_list
),
))
...
@@ -1326,6 +1331,14 @@ def tracing_monkeypatch(config):
...
@@ -1326,6 +1331,14 @@ def tracing_monkeypatch(config):
def
main
(
*
args
):
def
main
(
*
args
):
"Run default configuration."
"Run default configuration."
if
sys
.
platform
in
(
'cygwin'
,):
callAndRead
=
lambda
args
,
flag
=
True
:
args
.
insert
(
0
,
'/bin/sh'
)
\
or
real_callAndRead
(
args
,
flag
)
f
=
netifaces
.
ifaddresses
netifaces
.
ifaddresses
=
lambda
s
,
f
=
f
:
reduce
(
\
lambda
x
,
y
:[
x
.
__setitem__
(
k
,
v
+
x
.
get
(
k
,[]))
for
k
,
v
in
y
.
iteritems
()]
and
x
,
\
filter
(
None
,
[
f
(
i
)
for
i
in
netifaces
.
interfaces
()
if
i
.
startswith
(
s
)]),{})
# Parse arguments
# Parse arguments
usage
=
"usage: %s [options] CONFIGURATION_FILE"
%
sys
.
argv
[
0
]
usage
=
"usage: %s [options] CONFIGURATION_FILE"
%
sys
.
argv
[
0
]
options
,
configuration_file_path
=
Parser
(
usage
=
usage
).
check_args
(
args
)
options
,
configuration_file_path
=
Parser
(
usage
=
usage
).
check_args
(
args
)
...
...
slapos/grid/slapgrid.py
View file @
c2a99c9e
...
@@ -679,7 +679,7 @@ class Slapgrid(object):
...
@@ -679,7 +679,7 @@ class Slapgrid(object):
process_handler
=
subprocess
.
Popen
(
command
,
process_handler
=
subprocess
.
Popen
(
command
,
preexec_fn
=
lambda
:
dropPrivileges
(
uid
,
gid
),
preexec_fn
=
lambda
:
dropPrivileges
(
uid
,
gid
),
cwd
=
cwd
,
cwd
=
cwd
,
env
=
{},
**
kw
)
env
=
None
if
sys
.
platform
==
'cygwin'
else
{},
**
kw
)
process_handler
.
stdin
.
flush
()
process_handler
.
stdin
.
flush
()
process_handler
.
stdin
.
close
()
process_handler
.
stdin
.
close
()
process_handler
.
stdin
=
None
process_handler
.
stdin
=
None
...
...
slapos/grid/utils.py
View file @
c2a99c9e
...
@@ -95,6 +95,8 @@ class SlapPopen(subprocess.Popen):
...
@@ -95,6 +95,8 @@ class SlapPopen(subprocess.Popen):
"""
"""
def
__init__
(
self
,
*
args
,
**
kwargs
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
kwargs
.
update
(
stdin
=
subprocess
.
PIPE
)
kwargs
.
update
(
stdin
=
subprocess
.
PIPE
)
if
sys
.
platform
==
'cygwin'
and
kwargs
.
get
(
'env'
)
==
{}:
kwargs
[
'env'
]
=
None
subprocess
.
Popen
.
__init__
(
self
,
*
args
,
**
kwargs
)
subprocess
.
Popen
.
__init__
(
self
,
*
args
,
**
kwargs
)
self
.
stdin
.
flush
()
self
.
stdin
.
flush
()
self
.
stdin
.
close
()
self
.
stdin
.
close
()
...
...
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