Sha256: 737bbfb1def15be397f0dfc19c21079f5718583b8b9c28b21614799c551c3955

Contents?: true

Size: 1.36 KB

Versions: 17

Compression:

Stored size: 1.36 KB

Contents

class Eco::API::UseCases::Default::People::Treat::OrgDataConvertCase
  class Cli < Eco::API::UseCases::Cli
    str  = "Usage '#{cli_name} backup.json -restore-db-from'."
    str << " Transforms an input .json file to the values of the destination environment "
    str << " (names missmatch won't solve: i.e. usergroups)"
    desc str

    callback do |input, session, options|
      unless input.is_a?(Eco::API::Organization::People)
        file  = SCR.get_file(cli_name, required: true)
        input = Eco::API::Organization::People.new(JSON.parse(File.read(file)))
        session.log(:info) {
          "Source DB: loaded #{input.length} entries."
        }
      end

      unless options[:source_enviro]
        session.log(:error) {
          "You need to specify a -source-enviro for the conversion to work out"
        }
        exit(1)
      end
    end

    str = "The defined -source-enviro API configuration that the backup file was generated from"
    add_option("-source-enviro", str) do |options|
      options.merge!(source_enviro: SCR.get_arg("-source-enviro", with_param: true))
    end

    str = "Prevents the script to crash when backup file has missing usergroups in the org"
    add_option("-ignore-missing-policy-groups", str) do |options|
      options.deep_merge!(ignore: {missing: {policy_groups: true}})
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
eco-helpers-3.0.21 lib/eco/api/usecases/default/people/treat/cli/org_data_convert_cli.rb
eco-helpers-3.0.20 lib/eco/api/usecases/default/people/treat/cli/org_data_convert_cli.rb
eco-helpers-3.0.19 lib/eco/api/usecases/default/people/treat/cli/org_data_convert_cli.rb
eco-helpers-3.0.18 lib/eco/api/usecases/default/people/treat/cli/org_data_convert_cli.rb
eco-helpers-3.0.17 lib/eco/api/usecases/default/people/treat/cli/org_data_convert_cli.rb
eco-helpers-3.0.16 lib/eco/api/usecases/default/people/treat/cli/org_data_convert_cli.rb
eco-helpers-3.0.15 lib/eco/api/usecases/default/people/treat/cli/org_data_convert_cli.rb
eco-helpers-3.0.14 lib/eco/api/usecases/default/people/treat/cli/org_data_convert_cli.rb
eco-helpers-3.0.13 lib/eco/api/usecases/default/people/treat/cli/org_data_convert_cli.rb
eco-helpers-3.0.12 lib/eco/api/usecases/default/people/treat/cli/org_data_convert_cli.rb
eco-helpers-3.0.11 lib/eco/api/usecases/default/people/treat/cli/org_data_convert_cli.rb
eco-helpers-3.0.10 lib/eco/api/usecases/default/people/treat/cli/org_data_convert_cli.rb
eco-helpers-3.0.9 lib/eco/api/usecases/default/people/treat/cli/org_data_convert_cli.rb
eco-helpers-3.0.8 lib/eco/api/usecases/default/people/treat/cli/org_data_convert_cli.rb
eco-helpers-3.0.7 lib/eco/api/usecases/default/people/treat/cli/org_data_convert_cli.rb
eco-helpers-3.0.6 lib/eco/api/usecases/default/people/treat/cli/org_data_convert_cli.rb
eco-helpers-3.0.5 lib/eco/api/usecases/default/people/treat/cli/org_data_convert_cli.rb