Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
synnefo
Commits
df0a350d
Commit
df0a350d
authored
Apr 30, 2013
by
Christos Stavrakakis
Browse files
Merge branch 'develop' into feature-quotas
parents
2373cc88
d255a830
Changes
9
Hide whitespace changes
Inline
Side-by-side
docs/quick-install-admin-guide.rst
View file @
df0a350d
...
...
@@ -1801,7 +1801,7 @@ Edit ``/etc/default/vncauthproxy``:
.. code-block:: console
CHUID="www-data
:nogroup
"
CHUID="
nobody:
www-data"
We have now finished with the basic Cyclades and Plankton configuration.
...
...
snf-astakos-app/astakos/im/target/twitter.py
View file @
df0a350d
...
...
@@ -39,12 +39,12 @@ from django.utils.translation import ugettext as _
from
django.contrib
import
messages
from
django.template
import
RequestContext
from
django.views.decorators.http
import
require_http_methods
from
django.http
import
HttpResponseRedirect
from
django.http
import
HttpResponseRedirect
,
urlencode
from
django.core.urlresolvers
import
reverse
from
django.core.exceptions
import
ImproperlyConfigured
from
django.shortcuts
import
get_object_or_404
from
urlparse
import
urlunsplit
,
urlsplit
from
urlparse
import
urlunsplit
,
urlsplit
,
parse_qsl
from
astakos.im.util
import
prepare_response
,
get_context
,
login_url
from
astakos.im.views
import
requires_anonymous
,
render_response
,
\
...
...
@@ -67,9 +67,9 @@ import oauth2 as oauth
import
cgi
import
urllib
request_token_url
=
'http://twitter.com/oauth/request_token'
access_token_url
=
'http://twitter.com/oauth/access_token'
authenticate_url
=
'http://twitter.com/oauth/authenticate'
request_token_url
=
'http
s
://
api.
twitter.com/oauth/request_token'
access_token_url
=
'http
s
://
api.
twitter.com/oauth/access_token'
authenticate_url
=
'http
s
://
api.
twitter.com/oauth/authenticate'
@
requires_auth_provider
(
'twitter'
)
@
require_http_methods
([
"GET"
,
"POST"
])
...
...
@@ -125,7 +125,15 @@ def authenticated(
client
=
oauth
.
Client
(
consumer
,
token
)
# Step 2. Request the authorized access token from Twitter.
resp
,
content
=
client
.
request
(
access_token_url
,
"GET"
)
parts
=
list
(
urlsplit
(
access_token_url
))
params
=
dict
(
parse_qsl
(
parts
[
3
],
keep_blank_values
=
True
))
oauth_verifier
=
request
.
GET
.
get
(
'oauth_verifier'
)
params
[
'oauth_verifier'
]
=
oauth_verifier
parts
[
3
]
=
urlencode
(
params
)
parameterized_url
=
urlunsplit
(
parts
)
resp
,
content
=
client
.
request
(
parameterized_url
,
"GET"
)
if
resp
[
'status'
]
!=
'200'
:
try
:
del
request
.
session
[
'request_token'
]
...
...
snf-cyclades-app/synnefo/api/management/commands/network-create.py
View file @
df0a350d
...
...
@@ -146,6 +146,7 @@ class Command(BaseCommand):
link
=
options
[
'link'
]
mac_prefix
=
options
[
'mac_prefix'
]
tags
=
options
[
'tags'
]
userid
=
options
[
"owner"
]
if
not
name
:
raise
CommandError
(
"Name is required"
)
...
...
@@ -155,9 +156,8 @@ class Command(BaseCommand):
raise
CommandError
(
"Flavor is required"
)
if
public
and
not
backend_id
:
raise
CommandError
(
"backend-id is required"
)
if
backend_id
and
not
public
:
raise
CommandError
(
"Private networks must be created to"
" all backends"
)
if
not
userid
and
not
public
:
raise
CommandError
(
"'owner' is required for private networks"
)
if
mac_prefix
and
flavor
==
"MAC_FILTERED"
:
raise
CommandError
(
"Can not override MAC_FILTERED mac-prefix"
)
...
...
snf-cyclades-app/synnefo/api/management/commands/server-create.py
View file @
df0a350d
...
...
@@ -94,6 +94,8 @@ class Command(BaseCommand):
raise
CommandError
(
"user-id is mandatory"
)
if
not
password
:
raise
CommandError
(
"password is mandatory"
)
if
not
flavor_id
:
raise
CommandError
(
"flavor-id is mandatory"
)
# Get Flavor
if
flavor_id
:
...
...
snf-cyclades-app/synnefo/api/servers.py
View file @
df0a350d
...
...
@@ -338,7 +338,7 @@ def create_server(serials, request):
# create this NIC, because if the hooks never run (e.g. building error)
# the VM's public IP address will never be released!
NetworkInterface
.
objects
.
create
(
machine
=
vm
,
network
=
network
,
index
=
0
,
ipv4
=
address
,
state
=
"B
uidling
"
)
ipv4
=
address
,
state
=
"B
UILDING
"
)
log
.
info
(
"Created entry in DB for VM '%s'"
,
vm
)
...
...
snf-cyclades-app/synnefo/api/util.py
View file @
df0a350d
...
...
@@ -59,7 +59,7 @@ from django.db.models import Q
from
snf_django.lib.api
import
faults
from
synnefo.db.models
import
(
Flavor
,
VirtualMachine
,
VirtualMachineMetadata
,
Network
,
BackendNetwork
,
NetworkInterface
,
BridgePoolTable
,
MacPrefixPoolTable
)
BridgePoolTable
,
MacPrefixPoolTable
,
Backend
)
from
synnefo.db.pools
import
EmptyPool
from
snf_django.lib.astakos
import
get_user
...
...
@@ -267,6 +267,12 @@ def get_public_ip(backend):
This method should run inside a transaction.
"""
# Guarantee exclusive access to backend, because accessing the IP pools of
# the backend networks may result in a deadlock with backend allocator
# which also checks that backend networks have a free IP.
backend
=
Backend
.
objects
.
select_for_update
().
get
(
id
=
backend
.
id
)
address
=
None
if
settings
.
PUBLIC_USE_POOL
:
(
network
,
address
)
=
allocate_public_address
(
backend
)
...
...
snf-cyclades-app/synnefo/vmapi/models.py
View file @
df0a350d
...
...
@@ -35,6 +35,7 @@ from logging import getLogger
from
django.utils
import
simplejson
as
json
from
django.core.urlresolvers
import
reverse
from
urlparse
import
urljoin
from
synnefo.api.servers
import
server_created
from
synnefo.vmapi
import
backend
,
get_key
,
get_uuid
,
settings
...
...
@@ -49,10 +50,10 @@ def create_server_params(sender, created_vm_params, **kwargs):
log
.
info
(
"Setting vmapi params with key %s for %s"
,
key
,
sender
)
backend
.
set
(
key
,
json_value
)
config_url
=
urljoin
(
settings
.
BASE_URL
,
reverse
(
"vmapi_server_params"
,
args
=
[
uuid
]))
# inject sender (vm) with its configuration url
setattr
(
sender
,
'config_url'
,
"%s%s"
%
(
settings
.
BASE_URL
,
reverse
(
'vmapi_server_params'
,
args
=
[
uuid
])))
setattr
(
sender
,
'config_url'
,
config_url
)
return
uuid
server_created
.
connect
(
create_server_params
)
snf-webproject/synnefo/webproject/management/commands/__init__.py
View file @
df0a350d
...
...
@@ -104,6 +104,8 @@ class ListCommand(BaseCommand):
# Default filters and excludes
filters
=
{}
excludes
=
{}
# Order results
order_by
=
None
# Fields used only with user_user_field
astakos_url
=
None
...
...
@@ -240,6 +242,9 @@ class ListCommand(BaseCommand):
except
Exception
as
e
:
raise
CommandError
(
"Can not filter results: %s"
%
e
)
order_key
=
self
.
order_by
if
self
.
order_by
is
not
None
else
'pk'
objects
=
objects
.
order_by
(
order_key
)
# --display-mails option
display_mails
=
options
.
get
(
"display_mails"
)
if
display_mails
:
...
...
snf-webproject/synnefo/webproject/management/tests.py
View file @
df0a350d
import
sys
from
synnefo.webproject.management
import
util
from
synnefo.webproject.management
import
util
s
# Use backported unittest functionality if Python < 2.7
try
:
...
...
@@ -12,17 +12,20 @@ except ImportError:
class
ParseFiltersTestCase
(
unittest
.
TestCase
):
def
test_parse_empty
(
self
):
res
=
util
.
parse_filters
(
""
)
res
=
util
s
.
parse_filters
(
""
)
self
.
assertEqual
(
res
,
({},
{}))
def
test_parse_one
(
self
):
res
=
util
.
parse_filters
(
"x=2"
)
res
=
util
s
.
parse_filters
(
"x=2"
)
self
.
assertEqual
(
res
,
({
"x"
:
"2"
},
{}))
res
=
util
.
parse_filters
(
"x!=2"
)
res
=
util
s
.
parse_filters
(
"x!=2"
)
self
.
assertEqual
(
res
,
({},
{
"x"
:
"2"
}))
def
test_parse_many
(
self
):
res
=
util
.
parse_filters
(
"x=2,x>=3,y!=4,z<3"
)
res
=
util
s
.
parse_filters
(
"x=2,x>=3,y!=4,z<3"
)
filters
=
{
"x"
:
"2"
,
"x__gte"
:
"3"
,
"z__lt"
:
"3"
}
excludes
=
{
"y"
:
"4"
}
self
.
assertEqual
(
res
,
(
filters
,
excludes
))
if
__name__
==
'__main__'
:
unittest
.
main
()
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