Skip to content
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

100/vertical/git puppet scripts #234

Merged
merged 35 commits into from
Jan 25, 2019
Merged

Conversation

mewitte
Copy link

@mewitte mewitte commented Jan 10, 2019

Closes #100.
This pushes created puppet scripts (e.g. #97) to a private git repository. It uses git credentials and config for the currently logged in user.

Copy link
Contributor

@NiklasKoehnecke NiklasKoehnecke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its not tested yet. Most comments are more like questions/remarks but should probably be discussed with @arne-z

app/controllers/requests_controller.rb Outdated Show resolved Hide resolved
app/controllers/requests_controller.rb Outdated Show resolved Hide resolved
app/controllers/requests_controller.rb Outdated Show resolved Hide resolved
@Adrian-St Adrian-St force-pushed the 100/vertical/git-puppet-scripts branch from 549079f to 5487950 Compare January 14, 2019 11:33
Copy link
Contributor

@NiklasKoehnecke NiklasKoehnecke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line 22 of vms/requests/_form.html.erb gives me undefined method error for nil:NilClass when i try to create a request. That has probably nothing to do with you since you didn't change the file but still has to be noted


def self.generic_node_script
<<~NODE_SCRIPT
class node_vm-%s {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to Melvin this needs to be changed mentioned here


def self.generic_name_script
<<~NAME_SCRIPT
node \'vm-%s\'{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above

it 'returns correct declaration script for a given request' do
script = @request.generate_puppet_name_script
expected_string = <<~NAME_SCRIPT
node \'vm-MyVM\'{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above

it 'returns correct initialization script for a given request' do
script = @request.generate_puppet_node_script
expected_string = <<~NODE_SCRIPT
class node_vm-MyVM {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above

@Adrian-St Adrian-St merged commit 378fe6e into dev Jan 25, 2019
bdaase added a commit that referenced this pull request Feb 6, 2019
* 100/vertical/git puppet scripts (#234)

* Add puppet script functionality to request index

* Fix name generation, create puppet scripts in tmp

* Undo file creation, fix modal ids

* Change method names.

* Add puppet name script

* Add Git gem

* Add logic to push created puppet script to git

* Add button and route to push puppetscripts to git and fix code

* Use environment variables for github repository and user

* Add simple test for push_to_git route

* Extract logic to request model

* Add testing environment variables to example.yml and travis.yml

* Add notifications for different git actions

* Change travis.yml to not trigger multiple jobs

* Add more tests

* Add puppet_name_file to git push

* Apply Rubocop autofix

* Refactor request model

* Refactor tests

* Fix tests

* Fix tests

* Add tests for puppet script creation.

* Fix rubocop issues

* Fix tests

* Fix controller linting issues

* Extract request model logic into lib

* Unfix controller linting

* Change puppetscript and fix bugs

* Update tests to puppetscript change

* Uncomment git rescue

* Minor fixes to the server and request input fields (#319)

* Minor fixes

* Removed some dollar signs in puppet script (#325)

* Create Puppetscript init (#324)

* Change puppetscript init when a user is created

* Fix tests refactor git stub and add simple test

* Refactor githelper and tests

* Rubocop auto-correct

* 320/scaffold/Lost information when request is incomplete (#329)

* Should close #320

* Regression tests

* small refactoring

* Small refactoring

* 295/login/make-manage-visible-for-admins (#302)

* Make all manage actions accessible for admins

* make rubocop happy

* fix last specs

* 154/scaffold/email notifications (#338)

* working notifications, need to change seed etc. back when testing is over

* users can enable/disable email notifications, needs some beautyfication

* remove button and submit automatically, still need to remove some testing code

* autocorrect

* remove all test-code, only missing openID support now

* change comment

* add default false, not tested

* This should fix the mailer issues (#340)

* Add os to vm config edit page (#339)

* Add os to vm config edit page and make vm names to lower case when created

* Fix tests

* Make codefactor happy

* Fix some more tests

* Add vm comment to vm edit config page

* Do some refactoring

* Fix some CodeFactor

* update requests list (#330)

* show vm power buttons to admin, fix anchor linking #317 #319

Co-authored-by: tomschw <tom.schwarzburg@student.hpi.de>

* small layout fixes

Co-authored-by: tomschw <tom.schwarzburg@student.hpi.de>

* apply new theme to request list #309

Co-authored-by: tomschw <tom.schwarzburg@student.hpi.de>

* show pending and resolved requests seperately

* remove unnecessary line

* show number of pending and resolved requests

* move anchor reload fix to own file

* fix VM HDD usage

* update failing test

* fix VM CPU usage

* use yet another API value for VM max CPU speed

* remove VM deletion

* remove horizontal line in VM dropdown

* remove another unnecessary horizontal line in dropdown

* 326/scaffold/sudo users not stored (#331)

* Merge dev

* Start adding tests

* Refactor assign_sudo_users

* Should close #326

* Make CodeFactor happy

* Refactor prepare_params

* Small UI changes

* fix puppet script icon (#341)

* use different unicode char for puppet script button

* add icon shadow on hover

* hosts routes and button show only if user is admin (#335)

* add condition for hosts button to show only if user is admin, add restriction to hosts controller to be used by admins only

* 154/scaffold/beautify email notifications (#344)

* change formatting

* fix everything

* brauntoms pleasure

* Add end to end testing with capybara (#334)

* Add end to end test for request process

* Add automatic push when accepting requests (#346)

* Add automatic push when accepting requests

* Remove blank lines

* Add environment variables. (#347)

* Save ram and storage of a request in gb internally (#342)

* Save ram and storage of a request in gb internally

* Fix CodeFactor

* Fix Tests

* Fix same Tests, hopefully

* Forgot Gemfile

* Add some tests for request templates and convert gb to mibi and kibi for vsphere

* Rename comments

* Modify migration

* CodeFactor ...

* Modify migration again

* Refactor os on vm edit config page

* Remove catch in push to git.

* Revert "Remove catch in push to git."

This reverts commit 11f80f4.

* Re-add the Error so Errbit can log it.

* 148/scaffold/Complete VM to responsable relation (#284)

* Associate requests with responsible users

* Refactorings

* Test responsible user access in VSphere::VirtualMachine

* try to fix some issues of CodeFactor

* Refactoring

* Fix tests

* Add responsible users to VMConfigs

* More tests

* Fix potential issue, if a vm is called requests or configs

* Add tests for vm creation

* Responsible users are now also stored in the VM config

* responsible users are now assigned to virtual machines

* Add responsible to notificaiton

* Work on moving into correct subfolder

* VM now moves into the correct subfolder whenever its created, archived, revived or pending

* Move responsibilty for VM creation from folder to request

* Whoops

* Add test for move_into_correct_subfolder

* Migrate

* Fix end to end testing

* Fix some CodeFactor issues

* Remove unneccessary method

* Comment routes to be clearer why the change is neccessary

* Make CodeFactor a bit happy

* Fix in skipped test

* pleasure bjoern (#350)

* Update notify_email.html.erb

* Change request name regex (#352)

* Change request name regex

* Fix tests and remove uppercase letters from regEx

* Fix some more tests

* remove remnants of old vsphere api from hosts

* send notifications after various events (#343)

* send notification when role of an user is changed

* send notifications when new project is created

* fix tests

* add link to user page when role is changed

* try to fix CodeFactor

* second try to fix CodeFactor

* third try to fix CodeFactor

* third try to fix CodeFactor

* fifth try to fix CodeFactor

* sixth try to fix CodeFactor

* seventh try to fix CodeFactor

* consider review comments

* Fix buggy buttons on all requests page (#358)

* Add search bar to users page (#355)

* Add search bar to users page

* Add feature tests

* Fix double quoted strings

* add confirmation prompt before archiving and confiriming archiving (#356)

* Fix/add users to vm pages (#357)

* Add Responsible users to index page

* Fix vms routes

* Add users to show page

* Add links to users

* Readd rescue from Git Errors

* Add error message when git fails to push

* This should fix the tests

* Fix more tests

* Fix last tests

* Fix bug that caused the sudo users to not be udpated correctly

* Address requested changes

* Remove warning message, as its not working

* Remove links

* Restrict original user login to development mode

* Remove original sign in tests

* 340/scaffold/incorrect hdd stats (#361)

* Fix the issue

* Small refactoring

* This should fix the tests

* removed all user related data from seed

* Sort users alphabetically. (#363)

* Small bugfix

* Extend view

* Add test

* 304 - Tackles the webkit-issue by adding another POST-based route for logout (#365)

* Add a POST-based route for log out instead of DELETE-based

* Fix test to check against newly added route

* show VM DNS on detail page #348 (#364)

Co-authored-by: tomschw <tom.schwarzburg@student.hpi.de>

* Add logging for git actions

* Revert changes made to try to fix 304 webkit issue

* Just check if order of requiring js files is important

* Revert related test as well #304

* Remove scope created by first_or_create for User.all

* Fix and handle error with too many resources bug (#337)

fix and handle error with to many resources bug #308

* Add jquery js files at the top of application.js #304

* 238/vertical/import-update-puppet-scripts (#267)

* Add failing tests for puppet file parser [ci skip]

* Adapt puppet_helper tests

* Implement parsing of users and admins from puppet script

* Refactor tests to match rubocop

* Fix rubucop issues for app/helpers/puppet_parser_helper.rb

* Rework api function to get users

* Giving up on writing decent tests

* Fix typo in app/helpers/puppet_parser_helper.rb

* Skip tests that are written for old user management for now

* Repository should now be pulled before accessing [ci skip]

* Add setter for VM user management, revert repo handling

- Setters change the puppet file
- Git.open does not work at the moment

* Fix handling yield blocks

* [wip] merge [ci skip]

* Fix merge´

* [skip ci] Enable mocking of VM user association
Reenable tests

* [wip][ci skip] Add mock to associate user with vms

* [ci skip] Finish adding user connecting mocks

* Finishing up tests

* Rework dashboard test to work with user and vm connection

* Fix bug in getting all vms associated to a user

* [wip][ci skip] still merging

* Fix dashboard test

* Refactoring and rubocop

* Revert _list.html.erb

* debugging puppet script repo interaction #238

* mocking away User.update_repository #238

* Fix puppet parser helper tests

* Fix request spec

* Fix user spec

* Fixes tests and adheres to style guidelines

* Adhere to more style guidelines

* Fix typo

* fix notifications (#359)

* add project name in notification of project creation

* archive notificationwill be sent in 3 days

* fix some CodeFactor issues

* Fix typo

* Pull git repo instead of always deleting it (#369)

* Pull git repo instead of always deleting it

* Adhere to style guidelines

* Fix typo in git_helper.rb

* 237/vertical/Edit vm information (#281)

* Add failing tests for puppet file parser [ci skip]

* Adapt puppet_helper tests

* Implement parsing of users and admins from puppet script

* failing test for edit button

* adding "edit vm information" button, "edit" controller action and view #237

* view test for edit vm information page #237

* experimenting with vSphere API and User selecting on the edit page #237

* Refactor tests to match rubocop

* Fix rubucop issues for app/helpers/puppet_parser_helper.rb

* edit button in manage dropdown #237

* fixing edit tests and cleaning experimental html #237

* sudoers and non sudoers, description #237

* wip: saving the edits #237

* how the controller might should look like #237

* trying to formulate tests for changing a requests users lists #237

* Rework api function to get users

* Giving up on writing decent tests

* Fix typo in app/helpers/puppet_parser_helper.rb

* Skip tests that are written for old user management for now

* fixing view test for vms/:id/edit page #237

* change sudo users working 🎉 #237

* fixing some codefactor problems #237

* changing non-sudo users working 🎉 #237

* trying to see it in browser, too #237

* fixing small stuff #237

* fixing tests #237

* Repository should now be pulled before accessing [ci skip]

* fixing more small stuff #237

* fixing tests #237

* deleting unneccessary code #237

* reworking edit page and controller, ensuring config and description on vm creation

* fixing code style, fixing tests, migrating to config to take description #237

* correcting merge #237

* correcting merge 2/2 #237

* fixing tests #237

* Add setter for VM user management, revert repo handling

- Setters change the puppet file
- Git.open does not work at the moment

* Fix handling yield blocks

* removing request dependencies on the edit page and adding a test #237

* adding tests for notifying users with changed status regarding a VM edit #237

* running rubocop --auto-correct #237

* [wip] merge [ci skip]

* Fix merge´

* leading edit form to the right controller action #237

* removing empty first param on update #237

* [skip ci] Enable mocking of VM user association
Reenable tests

* [wip][ci skip] Add mock to associate user with vms

* [ci skip] Finish adding user connecting mocks

* Finishing up tests

* Rework dashboard test to work with user and vm connection

* Fix bug in getting all vms associated to a user

* [wip][ci skip] still merging

* Fix dashboard test

* Refactoring and rubocop

* Revert _list.html.erb

* debugging puppet script repo interaction #238

* mocking away User.update_repository #238

* edit WORKING when tested manually, notifications still defect #237

* Update virtual_machine.rb

* adding controller test #237

* cleanup with rubocop auto-correct and fixing typo #237

* cleanup #237

* cleanup #237

* cleanup #237

* moving vm mock into vsphere_api_mocker #237

* fixing typo #237

* reverting changes in mocker #237

* 259/vertical/request page refactoring (#367)

* Design requests page based on mockup.

* Add template-filled values.

* Save project with request.

* Add editing of port fowarding.

* Add texts to request form.

* Fix checkbox.

* Remove breakpoints.

* Fix resizing for select2 bootstrap theme.

* Fix request factory.

* Use factories in request tests.

* Update end-to-end tests.

* Fix most request controller tests.

* Fix remaining request controller tests.

* Make codefactor happy.

* Fix git errors (#371)

* Fix git errors

* Remove redundant begin block

* Repair find_or_create_by and change puppetfile path

* change callback set_user_id to before_create

* Moved Puppetscript methods to lib

* Fix: Speed up vms page loading time (#373)

* Fix git errors

* Remove redundant begin block

* Repair find_or_create_by and change puppetfile path

* change callback set_user_id to before_create

* Moved Puppetscript methods to lib

* Speed up dashboard loading times

* Update index.html.erb

* Fix/missing sudo users on create (#374)

* Fix the bug

* Refactoring

* Template selection now also works with keyboard input

* Don't show sudo users in the user field

* Fix error when creating a VM without correct git setup
includes refactorings

* Fix test

* Make CodeFactor happy
@arne-z arne-z deleted the 100/vertical/git-puppet-scripts branch February 7, 2019 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants