Merge branch 'bugfix_issue_327' of https://github.com/dheule/cdist
This commit is contained in:
		
				commit
				
					
						f9783f5f77
					
				
			
		
					 10 changed files with 26 additions and 26 deletions
				
			
		| 
						 | 
				
			
			@ -18,11 +18,11 @@
 | 
			
		|||
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
#
 | 
			
		||||
#
 | 
			
		||||
# Retrieve the id from the repo with the uri from parameter repo_uri  - parsed zypper output
 | 
			
		||||
# Retrieve the id from the repo with the uri from parameter uri  - parsed zypper output
 | 
			
		||||
#
 | 
			
		||||
#
 | 
			
		||||
if [ -f "$__object/parameter/repo_uri" ]; then
 | 
			
		||||
   uri="$(cat "$__object/parameter/repo_uri")"
 | 
			
		||||
if [ -f "$__object/parameter/uri" ]; then
 | 
			
		||||
   uri="$(cat "$__object/parameter/uri")"
 | 
			
		||||
else
 | 
			
		||||
   uri="$__object_id"
 | 
			
		||||
fi
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,8 +33,8 @@ else
 | 
			
		|||
   desc="$__object_id"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [ -f "$__object/parameter/repo_uri" ]; then
 | 
			
		||||
   uri="$(cat "$__object/parameter/repo_uri")"
 | 
			
		||||
if [ -f "$__object/parameter/uri" ]; then
 | 
			
		||||
   uri="$(cat "$__object/parameter/uri")"
 | 
			
		||||
else
 | 
			
		||||
   uri="$__object_id"
 | 
			
		||||
fi
 | 
			
		||||
| 
						 | 
				
			
			@ -65,7 +65,7 @@ fi
 | 
			
		|||
case "$state" in
 | 
			
		||||
   present)
 | 
			
		||||
         if [ -z "$desc" ] || [ -z "$uri" ]; then
 | 
			
		||||
             echo "parameter repo_desc and repo_uri for $state needed" >&2
 | 
			
		||||
             echo "parameter repo_desc and uri for $state needed" >&2
 | 
			
		||||
             exit 4
 | 
			
		||||
         fi
 | 
			
		||||
         if [ -z "$repo_id" ]; then
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,13 +22,13 @@ OPTIONAL PARAMETERS
 | 
			
		|||
-------------------
 | 
			
		||||
state::
 | 
			
		||||
    Either "present" or "absent" or "enabled" or "disabled", defaults to "present" + 
 | 
			
		||||
    #present#  - make sure that the repo is aviable, needs repo_uri and repo_desc + 
 | 
			
		||||
         for all following states, the repo can be searched via repo_id or repo_uri + 
 | 
			
		||||
    #present#  - make sure that the repo is aviable, needs uri and repo_desc + 
 | 
			
		||||
         for all following states, the repo can be searched via repo_id or uri + 
 | 
			
		||||
    #absent#   - drop the repo if found + 
 | 
			
		||||
    #enabled#  - a repo can have state disabled if installed via zypper service (ris), in this case, you can enable the repo + 
 | 
			
		||||
    #disabled# - instead of absent (drop), a repo can also set to disabled, wich makes it inaccessible + 
 | 
			
		||||
 | 
			
		||||
repo_uri::
 | 
			
		||||
uri::
 | 
			
		||||
    If supplied, use the uri and not the object id as repo uri.
 | 
			
		||||
 | 
			
		||||
repo_desc::
 | 
			
		||||
| 
						 | 
				
			
			@ -43,10 +43,10 @@ EXAMPLES
 | 
			
		|||
 | 
			
		||||
--------------------------------------------------------------------------------
 | 
			
		||||
# Ensure testrepo in installed
 | 
			
		||||
__zypper_repo testrepo --state present --repo_uri http://url.to.your.repo/with/path
 | 
			
		||||
__zypper_repo testrepo --state present --uri http://url.to.your.repo/with/path
 | 
			
		||||
 | 
			
		||||
# Drop repo by repo uri
 | 
			
		||||
__zypper_repo testrepo --state absent --repo_uri http://url.to.your.repo/with/path
 | 
			
		||||
__zypper_repo testrepo --state absent --uri http://url.to.your.repo/with/path
 | 
			
		||||
 | 
			
		||||
# Drop repo by id number (attention: repos are always numbered from 1 to max)
 | 
			
		||||
__zypper_repo testrepo --state absent --repo_id 1
 | 
			
		||||
| 
						 | 
				
			
			@ -55,7 +55,7 @@ __zypper_repo testrepo --state absent --repo_id 1
 | 
			
		|||
__zypper_repo testrepo2 --state enabled --repo_id 2
 | 
			
		||||
 | 
			
		||||
# enable repo by uri
 | 
			
		||||
__zypper_repo testrepo3 --state enabled --repo_uri http://url.to.your.repo/with/path
 | 
			
		||||
__zypper_repo testrepo3 --state enabled --uri http://url.to.your.repo/with/path
 | 
			
		||||
 | 
			
		||||
# disable a repo works like enabling it
 | 
			
		||||
__zypper_repo testrepo4 --state disabled --repo_id 4
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
state
 | 
			
		||||
repo_uri
 | 
			
		||||
uri
 | 
			
		||||
repo_desc
 | 
			
		||||
repo_id
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -20,8 +20,8 @@
 | 
			
		|||
#
 | 
			
		||||
# Manage services with Zypper (mostly suse)
 | 
			
		||||
#
 | 
			
		||||
if [ -f "$__object/parameter/service_uri" ]; then
 | 
			
		||||
   uri="$(cat "$__object/parameter/service_uri")"
 | 
			
		||||
if [ -f "$__object/parameter/uri" ]; then
 | 
			
		||||
   uri="$(cat "$__object/parameter/uri")"
 | 
			
		||||
else
 | 
			
		||||
   uri="/$__object_id"
 | 
			
		||||
fi
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -20,8 +20,8 @@
 | 
			
		|||
#
 | 
			
		||||
# Manage services with Zypper (mostly suse)
 | 
			
		||||
#
 | 
			
		||||
if [ -f "$__object/parameter/service_uri" ]; then
 | 
			
		||||
   uri="$(cat "$__object/parameter/service_uri")"
 | 
			
		||||
if [ -f "$__object/parameter/uri" ]; then
 | 
			
		||||
   uri="$(cat "$__object/parameter/uri")"
 | 
			
		||||
else
 | 
			
		||||
   uri="/$__object_id"
 | 
			
		||||
fi
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,8 +33,8 @@ else
 | 
			
		|||
   desc="$__object_id"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [ -f "$__object/parameter/service_uri" ]; then
 | 
			
		||||
   uri="$(cat "$__object/parameter/service_uri")"
 | 
			
		||||
if [ -f "$__object/parameter/uri" ]; then
 | 
			
		||||
   uri="$(cat "$__object/parameter/uri")"
 | 
			
		||||
else
 | 
			
		||||
   uri="$__object_id"
 | 
			
		||||
fi
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,7 +15,7 @@ zypper is usually used on SuSE systems to manage services.
 | 
			
		|||
 | 
			
		||||
REQUIRED PARAMETERS
 | 
			
		||||
-------------------
 | 
			
		||||
service_uri::
 | 
			
		||||
uri::
 | 
			
		||||
    Uri of the service
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -45,13 +45,13 @@ EXAMPLES
 | 
			
		|||
 | 
			
		||||
--------------------------------------------------------------------------------
 | 
			
		||||
# Ensure that internal SLES11 SP3 RIS is in installed and all other services and repos are discarded
 | 
			
		||||
__zypper_service INTERNAL_SLES11_SP3 --service_desc "Internal SLES11 SP3 RIS" --service_uri "http://path/to/your/ris/dir" --remove-all-other-services --remove-all-repos
 | 
			
		||||
__zypper_service INTERNAL_SLES11_SP3 --service_desc "Internal SLES11 SP3 RIS" --uri "http://path/to/your/ris/dir" --remove-all-other-services --remove-all-repos
 | 
			
		||||
 | 
			
		||||
# Ensure that internal SLES11 SP3 RIS is in installed, no changes to ohter services or repos
 | 
			
		||||
__zypper_service INTERNAL_SLES11_SP3 --service_desc "Internal SLES11 SP3 RIS" --service_uri "http://path/to/your/ris/dir"
 | 
			
		||||
__zypper_service INTERNAL_SLES11_SP3 --service_desc "Internal SLES11 SP3 RIS" --uri "http://path/to/your/ris/dir"
 | 
			
		||||
 | 
			
		||||
# Drop service by uri, no changes to ohter services or repos
 | 
			
		||||
__zypper_service INTERNAL_SLES11_SP3 --state absent --service_uri "http://path/to/your/ris/dir"
 | 
			
		||||
__zypper_service INTERNAL_SLES11_SP3 --state absent --uri "http://path/to/your/ris/dir"
 | 
			
		||||
 | 
			
		||||
--------------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -27,8 +27,8 @@
 | 
			
		|||
 | 
			
		||||
zypper_def_opts=" -q "
 | 
			
		||||
 | 
			
		||||
if [ -f "$__object/parameter/service_uri" ]; then
 | 
			
		||||
   uri="$(cat "$__object/parameter/service_uri")"
 | 
			
		||||
if [ -f "$__object/parameter/uri" ]; then
 | 
			
		||||
   uri="$(cat "$__object/parameter/uri")"
 | 
			
		||||
else
 | 
			
		||||
   uri="$__object_id"
 | 
			
		||||
fi
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1 +1 @@
 | 
			
		|||
service_uri
 | 
			
		||||
uri
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue