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
21
Merge Requests
21
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
1c5fcb24
Commit
1c5fcb24
authored
Apr 23, 2013
by
Marco Mariani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cli refactoring: supply, remove
parent
cd813da7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
70 additions
and
7 deletions
+70
-7
setup.py
setup.py
+2
-0
slapos/cli/remove.py
slapos/cli/remove.py
+28
-0
slapos/cli/supply.py
slapos/cli/supply.py
+28
-0
slapos/client.py
slapos/client.py
+12
-7
No files found.
setup.py
View file @
1c5fcb24
...
@@ -78,6 +78,8 @@ setup(name=name,
...
@@ -78,6 +78,8 @@ setup(name=name,
'node format = slapos.cli.format:FormatCommand'
,
'node format = slapos.cli.format:FormatCommand'
,
'node register = slapos.cli.register:RegisterCommand'
,
'node register = slapos.cli.register:RegisterCommand'
,
'console = slapos.cli.console:ConsoleCommand'
,
'console = slapos.cli.console:ConsoleCommand'
,
'supply = slapos.cli.supply:SupplyCommand'
,
'remove = slapos.cli.remove:RemoveCommand'
,
]
]
},
},
test_suite
=
"slapos.tests"
,
test_suite
=
"slapos.tests"
,
...
...
slapos/cli/remove.py
0 → 100644
View file @
1c5fcb24
# -*- coding: utf-8 -*-
import
logging
from
slapos.cli.config
import
ClientConfigCommand
from
slapos.client
import
init
,
do_remove
,
ClientConfig
class
RemoveCommand
(
ClientConfigCommand
):
log
=
logging
.
getLogger
(
__name__
)
def
get_parser
(
self
,
prog_name
):
ap
=
super
(
RemoveCommand
,
self
).
get_parser
(
prog_name
)
ap
.
add_argument
(
'software_url'
,
help
=
'Your software url'
)
ap
.
add_argument
(
'none'
,
help
=
"Target node"
)
return
ap
def
take_action
(
self
,
args
):
configuration_parser
=
self
.
fetch_config
(
args
)
config
=
ClientConfig
(
args
,
configuration_parser
)
local
=
init
(
config
)
do_remove
(
args
.
software_url
,
args
.
node
,
local
)
slapos/cli/supply.py
0 → 100644
View file @
1c5fcb24
# -*- coding: utf-8 -*-
import
logging
from
slapos.cli.config
import
ClientConfigCommand
from
slapos.client
import
init
,
do_supply
,
ClientConfig
class
SupplyCommand
(
ClientConfigCommand
):
log
=
logging
.
getLogger
(
__name__
)
def
get_parser
(
self
,
prog_name
):
ap
=
super
(
SupplyCommand
,
self
).
get_parser
(
prog_name
)
ap
.
add_argument
(
'software_url'
,
help
=
'Your software url'
)
ap
.
add_argument
(
'node'
,
help
=
"Target node"
)
return
ap
def
take_action
(
self
,
args
):
configuration_parser
=
self
.
fetch_config
(
args
)
config
=
ClientConfig
(
args
,
configuration_parser
)
local
=
init
(
config
)
do_supply
(
args
.
software_url
,
args
.
node
,
local
)
slapos/client.py
View file @
1c5fcb24
...
@@ -52,11 +52,11 @@ class Parser(OptionParser):
...
@@ -52,11 +52,11 @@ class Parser(OptionParser):
action
=
"store"
,
action
=
"store"
,
help
=
"Url of SlapOS Master to use."
),
help
=
"Url of SlapOS Master to use."
),
Option
(
"-k"
,
"--key_file"
,
Option
(
"-k"
,
"--key_file"
,
action
=
"store"
,
action
=
"store"
,
help
=
"SSL Authorisation key file."
),
help
=
"SSL Authorisation key file."
),
Option
(
"-c"
,
"--cert_file"
,
Option
(
"-c"
,
"--cert_file"
,
action
=
"store"
,
action
=
"store"
,
help
=
"SSL Authorisation certificate file."
)
help
=
"SSL Authorisation certificate file."
)
])
])
def
check_args
(
self
):
def
check_args
(
self
):
...
@@ -220,7 +220,7 @@ def request():
...
@@ -220,7 +220,7 @@ def request():
"couple of minutes to get connection informations."
)
"couple of minutes to get connection informations."
)
exit
(
2
)
exit
(
2
)
def
_supply
(
software_url
,
computer_id
,
local
,
remove
=
False
):
def
do
_supply
(
software_url
,
computer_id
,
local
,
remove
=
False
):
"""
"""
Request installation of Software Release
Request installation of Software Release
'software_url' on computer 'computer_id'.
'software_url' on computer 'computer_id'.
...
@@ -245,6 +245,9 @@ def _supply(software_url, computer_id, local, remove=False):
...
@@ -245,6 +245,9 @@ def _supply(software_url, computer_id, local, remove=False):
)
)
print
'Done.'
print
'Done.'
def
do_remove
(
software_url
,
node
,
local
):
do_supply
(
software_url
,
node
,
local
,
remove
=
True
)
def
supply
():
def
supply
():
"""
"""
Run when invoking slapos supply. Mostly argument parsing.
Run when invoking slapos supply. Mostly argument parsing.
...
@@ -260,7 +263,8 @@ def supply():
...
@@ -260,7 +263,8 @@ def supply():
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
config
=
ClientConfig
(
args
,
get_config_parser
(
args
.
configuration_file
))
config
=
ClientConfig
(
args
,
get_config_parser
(
args
.
configuration_file
))
_supply
(
args
.
software_url
,
args
.
node
,
init
(
config
))
local
=
init
(
config
)
do_supply
(
args
.
software_url
,
args
.
node
,
local
)
def
remove
():
def
remove
():
"""
"""
...
@@ -277,7 +281,8 @@ def remove():
...
@@ -277,7 +281,8 @@ def remove():
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
config
=
ClientConfig
(
args
,
get_config_parser
(
args
.
configuration_file
))
config
=
ClientConfig
(
args
,
get_config_parser
(
args
.
configuration_file
))
_supply
(
args
.
software_url
,
args
.
node
,
init
(
config
),
remove
=
True
)
local
=
init
(
config
)
do_remove
(
args
.
software_url
,
args
.
node
,
local
)
def
do_console
(
local
):
def
do_console
(
local
):
...
...
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