Class: ForemanDeployments::CreateResourcesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ForemanDeployments::CreateResourcesController
- Defined in:
- app/controllers/foreman_deployments/create_resources_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
rubocop:disable Metrics/MethodLength.
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
rubocop:disable Metrics/MethodLength
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/controllers/foreman_deployments/create_resources_controller.rb', line 18 def create params[:user].delete :admin if params[:user] # stack definition # will be selected from DB as Stack object stack = [ 'user1: !task:SearchResource', ' class: User', ' search_term: "1"', 'usergroup1: !task:CreateResource', ' class: Usergroup', ' params:', ' name: zzz', ' user_ids:', ' !reference', ' object: user1', ' field: result.ids' ].join("\n") # parse the stack stack_definition = ForemanDeployments::StackParser.parse(stack) # configure with user input # stack_definition.tasks['user1'].configure('params' => params[:user]) stack_definition.tasks['usergroup1'].configure({}) # validate result = ForemanDeployments::Validation::Validator.validate(stack_definition) fail "Validation failed:\n #{result.}" unless result.valid? ForemanTasks.sync_task(Tasks::StackDeployAction, stack_definition) redirect_to foreman_tasks_tasks_path end |
#destroy ⇒ Object
59 60 |
# File 'app/controllers/foreman_deployments/create_resources_controller.rb', line 59 def destroy end |
#edit ⇒ Object
53 54 |
# File 'app/controllers/foreman_deployments/create_resources_controller.rb', line 53 def edit end |
#index ⇒ Object
3 4 |
# File 'app/controllers/foreman_deployments/create_resources_controller.rb', line 3 def index end |
#new ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'app/controllers/foreman_deployments/create_resources_controller.rb', line 6 def new @resource = ResourceModels::CreateResource.new @resource.resource_type = User @resource.definition_hash = { login: 'my_user1', mail: '[email protected]' } @user = @resource.new_resource end |
#update ⇒ Object
56 57 |
# File 'app/controllers/foreman_deployments/create_resources_controller.rb', line 56 def update end |