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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nicolas Wavrant
slapos.core
Commits
b41b981f
Commit
b41b981f
authored
Apr 21, 2013
by
Marco Mariani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cli refactoring: node register
parent
61ee9971
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
217 additions
and
183 deletions
+217
-183
setup.py
setup.py
+1
-0
slapos/cli/register.py
slapos/cli/register.py
+79
-0
slapos/register/register.py
slapos/register/register.py
+137
-183
No files found.
setup.py
View file @
b41b981f
...
...
@@ -76,6 +76,7 @@ setup(name=name,
'cache lookup = slapos.cli.cache:CacheLookupCommand'
,
'node bang = slapos.cli.bang:BangCommand'
,
'node format = slapos.cli.format:FormatCommand'
,
'node register = slapos.cli.register:RegisterCommand'
,
]
},
test_suite
=
"slapos.tests"
,
...
...
slapos/cli/register.py
0 → 100644
View file @
b41b981f
# -*- coding: utf-8 -*-
import
logging
import
sys
from
cliff.command
import
Command
from
slapos.register.register
import
do_register
,
RegisterConfig
class
RegisterCommand
(
Command
):
log
=
logging
.
getLogger
(
'Register'
)
def
get_parser
(
self
,
prog_name
):
ap
=
super
(
RegisterCommand
,
self
).
get_parser
(
prog_name
)
ap
.
add_argument
(
'node_name'
,
help
=
'Name of the node'
)
ap
.
add_argument
(
'--interface-name'
,
help
=
'Interface name to access internet'
,
default
=
'eth0'
)
ap
.
add_argument
(
'--master-url'
,
help
=
'URL of SlapOS master'
,
default
=
'https://slap.vifib.com'
)
ap
.
add_argument
(
'--master-url-web'
,
help
=
'URL of SlapOS Master webservice to register certificates'
,
default
=
'https://www.slapos.org'
)
ap
.
add_argument
(
'--partition-number'
,
help
=
'Number of partition on computer'
,
default
=
'10'
,
type
=
int
)
ap
.
add_argument
(
'--ipv4-local-network'
,
help
=
'Base of ipv4 local network'
,
default
=
'10.0.0.0/16'
)
ap
.
add_argument
(
'--ipv6-interface'
,
help
=
'Interface name to get ipv6'
,
default
=
''
)
ap
.
add_argument
(
'--login'
,
help
=
'User login on SlapOS Master webservice'
)
ap
.
add_argument
(
'--password'
,
help
=
'User password on SlapOs Master webservice'
)
ap
.
add_argument
(
'-t'
,
'--create-tap'
,
help
=
'Will trigger creation of one virtual "tap" interface per '
'Partition and attach it to primary interface. Requires '
'primary interface to be a bridge. defaults to false. '
'Needed to host virtual machines.'
,
default
=
False
,
action
=
'store_true'
)
ap
.
add_argument
(
'-n'
,
'--dry-run'
,
help
=
'Simulate the execution steps'
,
default
=
False
,
action
=
'store_true'
)
return
ap
def
take_action
(
self
,
args
):
#if args.password and not args.login:
# # XXX we don't have the parser now, maybe could be handled with an argument group?
# ap.error('Please enter your login with your password')
try
:
config
=
RegisterConfig
(
logger
=
self
.
log
)
config
.
setConfig
(
args
)
return_code
=
do_register
(
config
)
except
SystemExit
,
err
:
# Catch exception raised by optparse
return_code
=
err
sys
.
exit
(
return_code
)
slapos/register/register.py
View file @
b41b981f
This diff is collapsed.
Click to expand it.
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