class Object

Public Class Methods

new(*args) click to toggle source
# File lib/satops.rb, line 62
def initialize(*args)
  old_initialize(*args)
  @ssl_context = OpenSSL::SSL::SSLContext.new
  @ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE
end

Public Instance Methods

config_syntax() click to toggle source
# File lib/satops.rb, line 111
def config_syntax
  :
# SatOps YAML comprehensive configuration file example
#
# Red Hat Network Satellite object groups
#   Activation Keys, Kickstart Profile, etc, with their specific options
#   An object group must be must be present to have a command executed against it
#
#   Options
#   'update' is a common option to allow corresponding object on target to be updated or not
#   Options are not mandatory - Default values are always either false, '' (empty) or nil
#
# Notes
#   YAML Format
#     Respect indentations using spaces not tabulations
#     Boolean values can be either yes/no or true/false
#     Receivers - left part of assignment are keywords: Do not change them!
#
Activationkeys:
  update: true
Configchannels:
  update: true
  # 'exclude' option provide a way to ignore some Config Channel objects
  # This is a list of regular expressions - Replace
  #exclude:
  #  - !ruby/regexp /^name1$/
  #  - !ruby/regexp /^name2$/
Channels:
  update: true
  delete: false
  # Triggers satellite-sync on Target providing the Source software channels
  iss: false
Kickstarts:
  update: true
KickstartFilepreservations:
  update: true
KickstartKeys:
  update: true
  # Type of keys. Default value is GPG. Other value would be SSL
  key_type: GPG
KickstartSnippets:
  update: true
Orgs:
  update: true
  entitlements: false
OrgTrusts:
  update: true
SystemCustominfos:
  update: true
Systems:
  update: true
Systemgroups:
  update: true
Users:
  update: true
  # Ignore deactivated users
  deactivated: false
  # By default extras users are deactivated not deleted
  delete: false
  # List of accounts to ignore
  exclude:
    - admin
    - satadmin
  # Default password used when creating user on target
  # It cannot be blank
  # When not using password then make sure PAM is activated
  password: "rhnapi"

end
overwrite_net_http() click to toggle source
# File lib/satops.rb, line 56
def overwrite_net_http
  # https: Client certificate isn't verified by server so each session generates:
  # "warning: peer certificate won't be verified in this SSL session"
  # To get rid of this warning: thanks to http://www.5dollarwhitebox.org/drupal/node/64
  Net::HTTP.class_eval do
    alias_method :old_initialize, :initialize
    def initialize(*args)
      old_initialize(*args)
      @ssl_context = OpenSSL::SSL::SSLContext.new
      @ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE
    end
  end
end
satellites_syntax() click to toggle source
# File lib/satops.rb, line 181
def satellites_syntax
:
# This is an example of a Satellite configuration file for the satOps
#
# This is a YAML formatted file
# Respect indentations using spaces not tabulations
# Boolean values can be either yes/no or true/false
#
# Do not remove any line
# Change only login and passwd values
--- !ruby/object:Configuration
source: !ruby/object:Host
  name: sat1.example.org
  user:
    :login: admin
    :passwd: redhat
target: !ruby/object:Host
  name: sat2.example.org
  user:
    :login: admin
    :passwd: redhat
  
end
syntax() click to toggle source
# File lib/satops.rb, line 74
def syntax
  :
Usage:
  satops show sat | config
  satops -s <sat file> -c <config file> [-dltw] destroy
  satops -s <sat file> -c <config file> [-dltw] export <directory> ascii | bin
  satops -s <sat file> -c <config file> [-dltw] import <directory> ascii | bin
  satops -s <sat file> -c <config file> [-dltw] run <Ruby file>
  satops -s <sat file> -c <config file> [-dltw] extras
  satops -s <sat file> -c <config file> [-dltw] sync
  satops [-h]

Mandatory Configuration:
  Sat file:    Source and Target RHN Satellites definition
  Config file: RHN Satellite objects and options
               Objects must be included to be processed
  Use 'show sat|config' command for generating either templates

Options:
  -d, --debug        Activate debug output
  -l, --log          Append logs to file. By default logs go to Standard Output
  -t, --tls          Activate SSL (HTTPS) sessions
  -w, --warnings     Activate Ruby Verbose

  -h, --help         Display this help and exit

Commands:
  destroy  Delete all objects on target RHN Satellite
  export   Export RHN Satellite objects to files (ascci or binary formats) into <directory>
  extras   Remove objects on target RHN Satellite not present in source RHN Satellite
  import   Import RHN Satellite object from files (ascii or binary) located into  <directory>
  run      Execute Ruby 'plug-in' file
  sync     Synchronise objects from source RHN Satellite to target RHN Satellite
  show     Generate configuration file examples

end