Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
python-grid5000
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SIMONIN Matthieu
python-grid5000
Commits
3a446ec3
"README.md" did not exist on "5cbfd5f43bd06acc35a79355992f290f21f29917"
Commit
3a446ec3
authored
3 years ago
by
SIMONIN Matthieu
Browse files
Options
Downloads
Patches
Plain Diff
Add programmable firewall interface
parent
f0325f9a
No related branches found
No related tags found
No related merge requests found
Pipeline
#310230
failed
3 years ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
grid5000/mixins.py
+1
-1
1 addition, 1 deletion
grid5000/mixins.py
grid5000/objects.py
+23
-2
23 additions, 2 deletions
grid5000/objects.py
with
24 additions
and
3 deletions
grid5000/mixins.py
+
1
−
1
View file @
3a446ec3
...
@@ -156,7 +156,7 @@ class CreateMixin(object):
...
@@ -156,7 +156,7 @@ class CreateMixin(object):
class
DeleteMixin
(
object
):
class
DeleteMixin
(
object
):
@exc.on_http_error
(
exc
.
Grid5000DeleteError
)
@exc.on_http_error
(
exc
.
Grid5000DeleteError
)
def
delete
(
self
,
id
,
**
kwargs
):
def
delete
(
self
,
id
=
None
,
**
kwargs
):
"""
Delete an object on the server.
"""
Delete an object on the server.
Args:
Args:
...
...
This diff is collapsed.
Click to expand it.
grid5000/objects.py
+
23
−
2
View file @
3a446ec3
...
@@ -2,6 +2,9 @@ from .base import * # noqa
...
@@ -2,6 +2,9 @@ from .base import * # noqa
from
.mixins
import
*
# noqa
from
.mixins
import
*
# noqa
class
FirewallPort
(
RESTObject
):
_id_attr
=
None
class
NetworkEquipment
(
RESTObject
):
class
NetworkEquipment
(
RESTObject
):
pass
pass
...
@@ -72,6 +75,11 @@ class Cluster(RESTObject):
...
@@ -72,6 +75,11 @@ class Cluster(RESTObject):
class
Job
(
RESTObject
,
RefreshMixin
,
ObjectDeleteMixin
):
class
Job
(
RESTObject
,
RefreshMixin
,
ObjectDeleteMixin
):
_create_attrs
=
((
"
command
"
),)
_create_attrs
=
((
"
command
"
),)
_managers
=
(
(
"
firewall
"
,
"
SiteJobFirewallManager
"
),
)
def
__repr__
(
self
):
def
__repr__
(
self
):
keys
=
[
"
uid
"
,
"
site
"
,
"
state
"
,
"
user
"
]
keys
=
[
"
uid
"
,
"
site
"
,
"
state
"
,
"
user
"
]
try
:
try
:
...
@@ -134,8 +142,6 @@ class JobManager(NoUpdateMixin, BracketMixin, RESTManager):
...
@@ -134,8 +142,6 @@ class JobManager(NoUpdateMixin, BracketMixin, RESTManager):
_path
=
"
/sites/%(site)s/jobs
"
_path
=
"
/sites/%(site)s/jobs
"
_obj_cls
=
Job
_obj_cls
=
Job
_from_parent_attrs
=
{
"
site
"
:
"
uid
"
}
_from_parent_attrs
=
{
"
site
"
:
"
uid
"
}
class
ClusterManager
(
RetrieveMixin
,
BracketMixin
,
RESTManager
):
class
ClusterManager
(
RetrieveMixin
,
BracketMixin
,
RESTManager
):
_path
=
"
/sites/%(site)s/clusters
"
_path
=
"
/sites/%(site)s/clusters
"
_obj_cls
=
Cluster
_obj_cls
=
Cluster
...
@@ -376,3 +382,18 @@ class SiteNetworkEquipmentManager(BracketMixin, RetrieveMixin, RESTManager):
...
@@ -376,3 +382,18 @@ class SiteNetworkEquipmentManager(BracketMixin, RetrieveMixin, RESTManager):
_path
=
"
/sites/%(site)s/network_equipments
"
_path
=
"
/sites/%(site)s/network_equipments
"
_obj_cls
=
NetworkEquipment
_obj_cls
=
NetworkEquipment
_from_parent_attrs
=
{
"
site
"
:
"
uid
"
}
_from_parent_attrs
=
{
"
site
"
:
"
uid
"
}
class
SiteJobFirewallManager
(
ListMixin
,
DeleteMixin
,
CreateMixin
,
RESTManager
):
_path
=
"
/sites/%(site)s/firewall/%(jobid)s
"
_obj_cls
=
FirewallPort
_from_parent_attrs
=
{
"
site
"
:
"
site
"
,
"
jobid
"
:
"
uid
"
}
@exc.on_http_error
(
exc
.
Grid5000CreateError
)
def
create
(
self
,
data
,
**
kwargs
):
# The api answer with a list of firewall rules
self
.
_check_missing_create_attrs
(
data
)
# Handle specific URL for creation
server_data
=
self
.
grid5000
.
http_post
(
self
.
path
,
post_data
=
data
,
**
kwargs
)
return
[
self
.
_obj_cls
(
self
,
s
)
for
s
in
server_data
]
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment