-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Verify configuration #713
base: master
Are you sure you want to change the base?
Verify configuration #713
Conversation
Hello contributor, thanks for submitting a PR for this project! I am the bot who triggers "standard-CI" builds for this project. In order to allow automated tests to run, please ask one of the project maintainers to review the code and then do one of the following:
|
7 similar comments
Hello contributor, thanks for submitting a PR for this project! I am the bot who triggers "standard-CI" builds for this project. In order to allow automated tests to run, please ask one of the project maintainers to review the code and then do one of the following:
|
Hello contributor, thanks for submitting a PR for this project! I am the bot who triggers "standard-CI" builds for this project. In order to allow automated tests to run, please ask one of the project maintainers to review the code and then do one of the following:
|
Hello contributor, thanks for submitting a PR for this project! I am the bot who triggers "standard-CI" builds for this project. In order to allow automated tests to run, please ask one of the project maintainers to review the code and then do one of the following:
|
Hello contributor, thanks for submitting a PR for this project! I am the bot who triggers "standard-CI" builds for this project. In order to allow automated tests to run, please ask one of the project maintainers to review the code and then do one of the following:
|
Hello contributor, thanks for submitting a PR for this project! I am the bot who triggers "standard-CI" builds for this project. In order to allow automated tests to run, please ask one of the project maintainers to review the code and then do one of the following:
|
Hello contributor, thanks for submitting a PR for this project! I am the bot who triggers "standard-CI" builds for this project. In order to allow automated tests to run, please ask one of the project maintainers to review the code and then do one of the following:
|
Hello contributor, thanks for submitting a PR for this project! I am the bot who triggers "standard-CI" builds for this project. In order to allow automated tests to run, please ask one of the project maintainers to review the code and then do one of the following:
|
Hello contributor, thanks for submitting a PR for this project! I am the bot who triggers "standard-CI" builds for this project. In order to allow automated tests to run, please ask one of the project maintainers to review the code and then do one of the following:
|
1 similar comment
Hello contributor, thanks for submitting a PR for this project! I am the bot who triggers "standard-CI" builds for this project. In order to allow automated tests to run, please ask one of the project maintainers to review the code and then do one of the following:
|
ci add to whitelist |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
I've posted a few comments.
@@ -67,7 +68,6 @@ | |||
'$PWD/.lago' | |||
), | |||
metavar='WORKDIR', | |||
type=os.path.abspath, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you remove this line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It shouldn't be removed
'-e', | ||
dest='envs_dir', | ||
help='Which directory the qemu has access permissions', | ||
default="/var/lib/lago", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This switch is about where the user is going to create the lago envs.
In /var/lib/lago
we store files that are being shared between the different envs.
I would use here os.curdir
, or take this value from lago.conf.
@lago.plugins.cli.cli_plugin_add_argument( | ||
'--username', | ||
'-u', | ||
help='Which user needs to be configured', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can add a default here:
getpass.getuser()
will return the name of the current user.
@in_lago_prefix | ||
@with_logging | ||
def do_setup( | ||
prefix, username, envs_dir, verify, **kwargs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in_lago_prefix
returns an object that represents a lago environment. In this case, we still don't have a lago env, so it's not needed.
if (os.getuid() != 0): | ||
print("Please use 'sudo', you need adminstrator permissions for configuration") | ||
sys.exit(1) | ||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need for an else
here. If the first condition was true, the program exited.
@@ -0,0 +1,293 @@ | |||
# | |||
# Copyright 2014 Red Hat, Inc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess that this file and all the others below are not needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need
I removed it later not to upload it in my local .gitignore
Display Lago configuration status (OK/Not-OK) Verify Lago configuration | ||
""" | ||
if (display_list): | ||
print "Configuration Status:" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A new verification step will require adding code in 4 different functions. It will be better to encapsulate all the information needed for a verification step inside an object.
""" | ||
(exit_code,res) = exec_cmd("cat /proc/cpuinfo | egrep 'vmx|svm'") | ||
|
||
if res == "": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not using a boolean here? return res == ""
current_permissions = stat.S_IMODE(os.lstat(path).st_mode) | ||
os.chmod(path, current_permissions & NO_WRITING) | ||
|
||
def check_permissions(envs_dirs,username): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space between arguments
Created lago setup command