-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1582 from cyberark/1581-conjurctl-start
1581 `rake policy:load` caused start script to fail
- Loading branch information
Showing
10 changed files
with
120 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# frozen_string_literal: true | ||
|
||
# Responsible for creating policy. Called when a POST request is received | ||
module Loader | ||
class CreatePolicy | ||
def initialize(loader) | ||
@loader = loader | ||
end | ||
|
||
def self.from_policy(policy_version) | ||
CreatePolicy.new(Loader::Orchestrate.new(policy_version)) | ||
end | ||
|
||
def call | ||
@loader.setup_db_for_new_policy | ||
|
||
@loader.delete_shadowed_and_duplicate_rows | ||
|
||
@loader.store_policy_in_db | ||
end | ||
|
||
def new_roles | ||
@loader.new_roles | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# frozen_string_literal: true | ||
|
||
# Responsible for modifying policy. Called when a PATCH request is received | ||
module Loader | ||
class ModifyPolicy | ||
def initialize(loader) | ||
@loader = loader | ||
end | ||
|
||
def self.from_policy(policy_version) | ||
ModifyPolicy.new(Loader::Orchestrate.new(policy_version)) | ||
end | ||
|
||
def call | ||
@loader.setup_db_for_new_policy | ||
|
||
@loader.delete_shadowed_and_duplicate_rows | ||
|
||
@loader.update_changed | ||
|
||
@loader.store_policy_in_db | ||
end | ||
|
||
def new_roles | ||
@loader.new_roles | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# frozen_string_literal: true | ||
|
||
# Responsible for replacing policy. Called when a PUT request is received | ||
module Loader | ||
class ReplacePolicy | ||
def initialize(loader) | ||
@loader = loader | ||
end | ||
|
||
def self.from_policy(policy_version) | ||
ReplacePolicy.new(Loader::Orchestrate.new(policy_version)) | ||
end | ||
|
||
def call | ||
@loader.setup_db_for_new_policy | ||
|
||
@loader.delete_removed | ||
|
||
@loader.delete_shadowed_and_duplicate_rows | ||
|
||
@loader.update_changed | ||
|
||
@loader.store_policy_in_db | ||
end | ||
|
||
def new_roles | ||
@loader.new_roles | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Feature: Rake task to load Conjur policy | ||
|
||
Conjur includes a Rake task (`rake policy:load`) for loading policies from | ||
within the Conjur container. This rake task is used by the `conjurctl policy | ||
load` | ||
|
||
Scenario: Load a simple policy using `rake policy:load` | ||
|
||
When I load a policy from file "policy.yml" using conjurctl | ||
Then user "test" exists | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# frozen_string_literal: true | ||
|
||
When(/^I load a policy from file "([^"]*)" using conjurctl/) do |filename| | ||
absolute_path = "#{File.dirname __FILE__}/../support/#{filename}" | ||
rake_task = ["rake", "policy:load[cucumber, #{absolute_path}]"] | ||
system(*rake_task) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- !user test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters